useConstrainedTabbing steals focus from elements with tabindex="-1" #34681
Labels
[Focus] Accessibility (a11y)
Changes that impact accessibility and need corresponding review (e.g. markup changes).
[Package] Components
/packages/components
[Status] In Progress
Tracking issues with work in progress
[Type] Bug
An existing feature does not function as intended
Description
If an element with
tabindex="-1"
is focused and is rendered inside a component usinguseConstrainedTabbing()
, pressing Tab will not focus the next focusable element, but instead it will go back to the first focusable item.Step-by-step reproduction instructions
One way to reproduce this issue is to modify the
<Modal>
story:gutenberg/packages/components/src/modal/stories/index.js
Lines 31 to 35 in 9df736c
Like this:
npm run storybook
.Button 3
.placeholder-div
.Expected behavior:
4. Pressing Tab will focus
Button 2
.Actual behavior:
4. Pressing Tab focuses close button.
Screenshots, screen recording, code snippet
Actual:
actual.mp4
Expected:
expected.mp4
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: