Cannot automatically focus TextInput within DialogExtension modal #330
Labels
bug
Something isn't working as expected
needs review
Proposal/bug that needs to be reviewed by maintainers
v4
Changes that will be delivered in the version 4
It seems that you cannot automatically focus a TextInput component within a DialogExtension modal.
Repro:
create-contentful-extension
and begin developmentUsing autoFocus prop
autoFocus
Expected: TextInput automatically focuses, enabling typing immediately
Actual: TextInput does not focus, requiring a click to begin typing
Using inputRef and focusing in componentDidMount
In the Text input, pass
this.input
as theinputRef
prop to the TextInput componentWhen extension rebuilds, click the button that opens the dialog
Expected: TextInput automatically focuses, enabling typing immediately
Actual: TextInput does not focus, requiring a click to begin typing
You can confirm refs are passing correctly by adding a Button component with the following
onClick
prop:() => this.input.current.focus()
Expected: On click, input gains focus
Actual: On click, input gains focus
The text was updated successfully, but these errors were encountered: