Hello,
It's impossible to manage hit area for textfield and it's already too small by default (detected with Accessibility Inspector).
I'm tried to force with modifier "frame(minHeight: xxx)", the component change the height but the hit area is still in same size.
Have to tips to fix this issue?
Hello,
Long delay here, but this came up for me recently, figured I'd post the solution on the forums for all to benefit :)
The following approach will increase the hit-area of a view without the side-effects on layout:
TextField("Example", text: $text)
.focused($isFocused)
.contentShape(Rectangle().inset(by: -20)) // The negative inset on the content shape is key. This expands the content shape without affecting layout.
.onTapGesture {
isFocused = true
}
Hope this helps others dealing with a similar issue!
--Greg