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
fix(TabNav): update focus strategy after initial focus #2468
Conversation
🦋 Changeset detectedLatest commit: 25b78c2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
size-limit report 📦
|
… into 2340-add-tmp-fix-for-tabnav
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested the fix using the example from this CodeSandbox.
It works and I understand why 👍
I just want to confirm that users should not expect to have focus moved to the tabs when focused on the previous element and press the right arrow, or when focused on the next element and press the left arrow.
Closes #2340
This PR introduces a temporary fix for
TabNav
to allow its participation in parent focus zones (like when used inActionMenu
). It tracks when initial focus was set in order to supportaria-selected
and then uses theprevious
strategy inuseFocusZone
afterwards to mirror a typical roving index setup.This allows its participation in parent focus zones that are expecting a different item to be focused than the current focus strategy present in
TabNav
(which defaults to thearia-selected
tab)Testing
I re-created the codesandbox from: #2340 inside of a story in
ActionMenu/examples.stories.tsx
as a test for this scenario. I don't believe this should be an official story since this scenario is not supported but wanted to share to help out reviewers to re-create the original issue and verify the fix.