-
Notifications
You must be signed in to change notification settings - Fork 50.4k
Add option to includeNegativeTabIndex in getFocusableElementsInScope #16000
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
Add option to includeNegativeTabIndex in getFocusableElementsInScope #16000
Conversation
…FocusableElementsInScope
|
ReactDOM: size: 0.0%, gzip: -0.0% Details of bundled changes.Comparing: 9b55bcf...e08e3fb react-dom
Generated by 🚫 dangerJS |
I don't think we should look to support values other than We're also using this event component with UI components that set tabindex to |
That's a fair point. I'll undo that change and only accept
I'm playing with the |
|
I'm not sure how this would be useful in a context where every View renders down to |
If every Basing this on reading https://html.spec.whatwg.org/multipage/interaction.html#attr-tabindex and https://html.spec.whatwg.org/multipage/interaction.html#focusable-area. Specifically:
When I say a tabbable element (or a tab stop), I mean that the element is part of the "sequential focus navigation order" as defined by the spec. Probably also worth noting that I feel that the name
I'm not very familiar with the semantics of the
My motivation for wanting to be able to distinguish between tabbable and focusable elements is rooted the use case of implementing roving tabindex (use tab key to move focus to across lists and arrow keys to move focus across list items within the current list). An alternative to this pull request could be adding |
|
You should check out the other PR that adds focus manager to FocusScope too. There might be ideas that can be expanded on if similar. #15849 |
I understand the semantic differences, although "tabbable" doesn't communicate that the element can also receive focus from other user actions, like mouse or touch. That's one reason why we avoid using "tabbable" for multi-input APIs.
This is what I'm trying to understand; whether you might be making assumptions about what elements will have What is it that you want to do with a list of "focusable" elements? And what is it about
I considered this too. We're using |
|
FWIW, I added a |
Fair point :). I hadn't considered that.
I might be making assumptions here. I'm trying my best to conform to the HTML Spec and ARIA guidelines. Please let me know if I'm misunderstanding something here. I'm trying to follow the ARIA guidelines for using roving tabindex for focus management (https://www.w3.org/TR/wai-aria-practices/#kbd_roving_tabindex). Here's a specific use case I want to enable: When
I have not given sufficient thought to the desirability of proliferating |
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution. |
|
Closing this pull request after a prolonged period of inactivity. If this issue is still present in the latest release, please ask for this pull request to be reopened. Thank you! |
The idea for this pull request came up when @trueadm and I were talking about being able to differentiate between focusable and tabbable elements (to implement something like roving tabindex for focus management as recommended within aria best practices guide: https://www.w3.org/TR/wai-aria-practices/#kbd_roving_tabindex).
The current
getFocusableElementsInScopeimplementation treats elements withtabIndex === -1as not focusable. This introduces as boolean flag (includeNegativeTabIndex) that disables thetabIndex < 0filter. Also made the logic more generic to accommodate fortabIndexvalues other than-1and0. And I added some tests :)