Skip to content
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] Arrow left / right with opened submenu without focused item work unexpectedly #8530

Open
web-padawan opened this issue Jan 17, 2025 · 0 comments
Labels
bug Something isn't working vaadin-menu-bar

Comments

@web-padawan
Copy link
Member

web-padawan commented Jan 17, 2025

Description

Currently the behavior of vaadin-menu-bar is incorrect when opening submenu but not focusing any item.

Arrow Left

  1. Click to open submenu -> Arrow Down to focus item -> Arrow Left = previous root level button focused (CORRECT)
  2. Click to open submenu -> Arrow Left = same root level button focused (WRONG)

Arrow RIght

  1. Click to open submenu -> Arrow Down to focus item -> Arrow Right = next root level button focused (CORRECT)
  2. Click to open submenu -> Arrow Right = submenu stays open, nothing happens (WRONG)

Expected outcome

Expected the focus to move on Arrow Left or Arrow Right regardless of whether the item in submenu is focused or not.
See ARIA authoring practices - Navigation Menubar example for the correct behavior.

Minimal reproducible example

  <vaadin-menu-bar></vaadin-menu-bar>

  <script type="module">
    import '@vaadin/menu-bar';

    const menuBar = document.querySelector('vaadin-menu-bar');
    menuBar.items = [
      { text: 'View' },
      {
        text: 'Move',
        children: [{ text: 'To folder' }, { text: 'To trash' }],
      },
      { text: 'Duplicate' },
    ];
  </script>

Steps to reproduce

  1. Add the snippet to the HTML page
  2. Click "Move" button to open submenu
  3. Press Arrow Left or Arrow Right

Environment

Vaadin version(s): 24.7 and earlier

Browsers

Issue is not browser related

Note

Without focusing item, the keydown event is fired from the context menu but item is empty here:

__onContextMenuKeydown(e) {
const item = Array.from(e.composedPath()).find((el) => el._item);
if (item) {

@web-padawan web-padawan added bug Something isn't working vaadin-menu-bar labels Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working vaadin-menu-bar
Projects
None yet
Development

No branches or pull requests

1 participant