Skip to content

Conversation

@joshblack
Copy link
Member

@joshblack joshblack commented Oct 21, 2022

Closes #2340

This PR introduces a temporary fix for TabNav to allow its participation in parent focus zones (like when used in ActionMenu). It tracks when initial focus was set in order to support aria-selected and then uses the previous strategy in useFocusZone 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 the aria-selected tab)

Note
ActionMenu does not support TabNav as a child, it should only accept menuitem, menuitemradio, or menuitemcheckbox

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.

@joshblack joshblack requested review from a team and mperrotti October 21, 2022 20:59
@changeset-bot
Copy link

changeset-bot bot commented Oct 21, 2022

🦋 Changeset detected

Latest commit: 25b78c2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Patch

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

@github-actions
Copy link
Contributor

github-actions bot commented Oct 21, 2022

size-limit report 📦

Path Size
dist/browser.esm.js 78.14 KB (+0.03% 🔺)
dist/browser.umd.js 78.79 KB (+0.02% 🔺)

Copy link
Contributor

@mperrotti mperrotti left a 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.

@joshblack joshblack enabled auto-merge (squash) October 25, 2022 15:08
@joshblack joshblack temporarily deployed to github-pages October 25, 2022 15:14 Inactive
@joshblack joshblack merged commit 9dcf61b into main Oct 25, 2022
@joshblack joshblack deleted the 2340-add-tmp-fix-for-tabnav branch October 25, 2022 15:17
@primer-css primer-css mentioned this pull request Oct 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

focus gets stuck in TabNav focuszone within ActionMenu.Overlay

3 participants