-
Notifications
You must be signed in to change notification settings - Fork 83
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
[menu-bar] Add possibility to disable roving tabindex #7525
Conversation
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.
Found one issue so far: when pressing Arrow Left / Arrow Right on the sub-menu item, we move the focus to the other button while also opening corresponding sub-menu.
This doesn't currently work with Tab, see the following example:
menu-tab.mp4
<vaadin-menu-bar tab-navigation></vaadin-menu-bar>
<script type="module">
import '@vaadin/menu-bar';
const menuBar = document.querySelector('vaadin-menu-bar');
menuBar.items = [
{ text: 'View' },
{ text: 'Edit' },
{
text: 'Share',
children: [{ text: 'By email' }, { text: 'Get link' }],
},
{
text: 'Move',
tooltip: 'Move to a different folder or trash.',
children: [{ text: 'To folder' }, { text: 'To trash' }],
},
];
</script>
- Focus the last button with Tab or arrow key
- Press Enter to open the sub-menu
- Press Arrow Left - the sub-menu will move to previous button
- Press Tab - focus moves but the sub-menu does not
Good point. In fact it only affects the case of using Shift Tab to get to the Personally I think it's a minor change, and the old behavior could be considered confusing. So IMO we can keep it and just update the snapshot to pass with the change using |
I've just added some tests for:
|
Yes, it's better to copy these helpers and place them in a separate file |
Done |
Keep the submenu opened on tab navigation
a55483e
to
c6747ee
Compare
Quality Gate passedIssues Measures |
SauceLabs tests failed due to the fact that it's a PR from fork. This is fine in this case as theme isn't changed. The code LGTM, made some small tweaks (see latest commits). I'll go ahead and merge the PR. |
This ticket/PR has been released with Vaadin 24.5.0.alpha10 and is also targeting the upcoming stable 24.5.0 version. |
Description
MenuBar is sometimes used with styling that makes MenuItems appear as separate Buttons. Especially in this case the expected focus behavior would be to move focus between MenuItems with TAB key instead of arrow keys.
Fixes #6718
Acceptance Criteria: vaadin/platform#6552
Few things that are not in the AC.
When the tabNavigation is true, the navigation with Arrow keys is not removed. You can still navigate with TAB and arrow keys. The behavior is similar to a MacOs menu (for example).
You can still create submenu and they will work the same way (same navigation).
The overflow menu will work as before (like a submenu).
There is no specific tests when it's working the same way.
Type of change
Checklist
Additional for
Feature
type of change