Skip to content

Commit ee060b5

Browse files
authored
fix(S2): forward focus to textarea in FieldGroup (#9037)
1 parent 23b3f43 commit ee060b5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/@react-spectrum/s2/src/Field.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,13 +197,13 @@ export const FieldGroup = forwardRef(function FieldGroup(props: FieldGroupProps,
197197
// Forward focus to input element when clicking on a non-interactive child (e.g. icon or padding)
198198
if (e.pointerType === 'mouse' && !(e.target as Element).closest('button,input,textarea')) {
199199
e.preventDefault();
200-
e.currentTarget.querySelector('input')?.focus();
200+
(e.currentTarget.querySelector('input, textarea') as HTMLElement)?.focus();
201201
}
202202
}}
203203
onPointerUp={e => {
204204
if (e.pointerType !== 'mouse' && !(e.target as Element).closest('button,input,textarea')) {
205205
e.preventDefault();
206-
e.currentTarget.querySelector('input')?.focus();
206+
(e.currentTarget.querySelector('input, textarea') as HTMLElement)?.focus();
207207
}
208208
}}
209209
style={props.UNSAFE_style}

0 commit comments

Comments
 (0)