-
Notifications
You must be signed in to change notification settings - Fork 71
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
<AutoFocusInside/> ignores tabIndex={-1} #108
Comments
That's a good addition. Right now autofocus is searched only among tabbable (aka focusable via keyboard navigation), however should be searched as "focusable". |
I'm not entirely sure if by default the search should go through all focusable elements - this could be a surprise in certain situations. However, it definitely should be possible to autoFocus such elements (non-tabbables) if there is a sufficiently explicit indicator of wanting this, where usage of |
Ok. Root cause found - 👍 a very good thing to fix. |
v2.4.0 should resolve your issue |
Explicit information like using the
<AutoFocusInside/>
should take precedence over the regular tabbable sequence, and this IMHO includes components withtabIndex={-1}
. Alternatively, this could be controlled with some extra prop.Why this is needed?
Sometimes it is advisable to autofocus such elements, according to https://w3c.github.io/aria-practices/#keyboard-interaction-7 :
Repro:
https://codesandbox.io/s/react-focus-lock-n1w2r?file=/index.js
The text was updated successfully, but these errors were encountered: