TreeGrid: set initial tabindex attributes for the roving tabindex #69320
Labels
[Focus] Accessibility (a11y)
Changes that impact accessibility and need corresponding review (e.g. markup changes).
[Package] Components
/packages/components
[Type] Bug
An existing feature does not function as intended
Description
Noticed while working on #69147 / #69190
The TreeGrid roving tabindex inplementation is within the RovingTabIndexItem component and works in a way that the
tabinxed
attributes are set only when one of the items in the tree grid receives focus.This means that on initial first rendering, all the items are focusable. I'm not sure this is ideal because it may lead to problems when other components manage focus on the tree grid or other components that wrap it, as noticed in #69147.
To remind what an ARIA widget with roving tabindex is supposed to do:
However, on first render, all items are focusable and tabbable because none of them has a
tabindex
attribute set, yet.Ideally, also on first render there should be only one focusable/tabbable item. That is: all the items should have a
tabindex="-1"
attribute except the first one that should have atabindex="0"
instead. Optionally, the initial tabbable item should be configurable via a prop.Step-by-step reproduction instructions
tabindex
attribute.tabindex="0"
attribute.tabindex="-1"
attribute.Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Please confirm which theme type you used for testing.
The text was updated successfully, but these errors were encountered: