-
Notifications
You must be signed in to change notification settings - Fork 27
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
feat(navbar keyboard navigation): optionally navigate to submenu items using the Tab
and Enter
keys.
#3482
feat(navbar keyboard navigation): optionally navigate to submenu items using the Tab
and Enter
keys.
#3482
Conversation
🦋 Changeset detectedLatest commit: 4e07032 The changes in this PR will be included in the next version bump. This PR includes changesets to release 37 packages
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 |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
…r keyboard navigation
…r keyboard navigation
The key features, as concluded on a call with @FilPob and @CarlosCortizasCT should be:
|
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.
Big thanks for the improvements, it's a big step forward 🚀
Here's my feedback:
-
I'm uncertain about one aspect—when a menu item is focused, the submenu appears, but then closes upon the next Tab key press. I would expect that once the submenu is open we are able to navigate it with the next Tab key press. Currently, it feels a bit ambiguous whether pressing Enter allows entry (although if this was a deliberate decision, I'm ok with that)
-
Additionally, I've encountered what seems to be a bug. Pressing Enter on any menu item results in submenu items always being focusable.
Thank you Kacper, Scenario 1: When a menu item is focused, Scenario 2: If the
I will look into this, thank you! 👍🏾 |
Thanks Douglas 🙏,
Those scenarios are clear to me 👍 My question was: if a menu item gets focus, should the submenu open automatically or only after Enter press? |
Thanks again @kark , so that was the initial implementation I had but later updated to show a preview of the submenu when a menu item gains focus. it was one of the requirements we initially discussed with @FilPob (although in our last call, he was okay with it implemented either ways) |
To be honest, I don't like the behaviour of displaying the submenu on keyboard navigation focus, but that's a design request so we must evaluate if it's not too complicated to implement. |
Thanks a lot for working on this, @ddouglasz 🙇 From the functionality point of view, it is working as I think it was expected but I'd like for us to align on what we actually want to have as a feature. Currently we have implemented the navigation using the Also, I think we said the tabular navigation was a first step but that we could build the arrows keys navigation also as an extra feature. To me it's ok to merge the feature as it currently is, but I want us to be aligned in terms of the expectations of this PR and if we want to do more follow-up work. cc/ @FilPob |
totally agree. I think for the scope of this PR the behaviour is OK. For follow up work we should align first on the expectations |
@ddouglasz could you please updated the title and description of the PR accordingly? 🙏 |
Tab
and Enter
keys.
Updated. Thank you |
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.
Looks good to me.
Thanks 👍
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.
🙌🏽
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.
Thanks Douglas. Just a final comment from my end
packages/application-shell/src/components/navbar/menu-items.tsx
Outdated
Show resolved
Hide resolved
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.
Thanks again, works as expected 🙌
…s using the `Tab` and `Enter` keys. (#3482) * feat(navbar keyboard navigation): add arrow keys navigation to navbar * feat(navbar keyboard navigation): add arrow keys navigation to navbar * feat(navbar keyboard navigation): add event types * feat(navbar keyboard navigation): cleanup unused code * feat(navbar keyboard navigation): make Tab and Enter key primarily for keyboard navigation * feat(navbar keyboard navigation): make Tab and Enter key primarily for keyboard navigation * feat(navbar keyboard navigation): tabIndex to focus submenu container * feat(navbar keyboard navigation): update changeset * feat(navbar keyboard navigation): rename state variable * feat(navbar keyboard navigation): prevent default enter behaviour * feat(navbar keyboard navigation): handle submenu state after onBlur * feat(keyboard navigation): add submenu preview on navigation * feat(keyboard navigation): remove unused variables * feat(accessibility): remove unused hook * feat(main nav accessibility): update focus when navigating to a new submenu --------- Co-authored-by: Ddouglasz <douglas.egiemeh@gmail.com>
Follow up to navbar keyboard navigation.
Summary
Optionally navigate to submenu items using the
Tab
andEnter
keys. This way, we can choose to navigate through the submenu of a menu item that has a submenu or skip the submenu and move to the next menu item.Some context can be found in the github conversation here.