-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
autofocus
doesn't work for focusing an input
#153
Comments
Hello, and thank you for opening an issue. I created a small demo with an input with the |
Thanks for the fast response! This is interesting because that example doesn't seem to work for me either. I just tested it with Chrome and Safari, it looks like Safari does actually get the focus set to the right place, although the input is only focused after pressing tab? Chrome doesn't appear to have any special behaviour (after pressing tab the container is focused). So additionally, is the input field meant to immediately be focused? Reading through the code I can't see why not. |
The The example did not work for me either. I guess it should work by focusing the element on the |
I’m not sure the library can do too much about this but we should at least clarify it in the README. |
In the documentation for a11y-dialog, it mentions that the library will look for an input with the
autofocus
property set when opening the dialog, however React doesn't support this property directly, instead requiring the use ofautoFocus
(notice the camel case), which doesn't render in the html and polyfills the autofocus behaviour provided by the browser. This of course doesn't seem to work with this library. Is there another method I can use to get autofocus behaviour in React aside from storing a ref to my input?The text was updated successfully, but these errors were encountered: