Skip to content

MenuItems as Link break keyboard input #33268

@Mario-Eis

Description

@Mario-Eis

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

The issue of using menu items as router links or anchors was already discussed here: #204. But all the suggested solutions will break the keyboard navigation of the menu list.

UPDATE: I found out, that deleting the additional <li> seems to restore the keyboard functionality. Unfortunately this breaks the markup. <ul> <a/> <a/> <li/> </ul>

Expected behavior 🤔

When a menu list is focused and the keyboard arrows are pressed, the corresponding menu item is selected. This should also be true for navigational entries like anchors or router links.

Steps to reproduce 🕹

Use menu items as links with the suggested way to do it.

<MenuList>
    <li>
        <MenuItem
            component="a"
            href="https://google.com"
            target="_blank"
        >Google</MenuItem>
    </li>
</MenuList>

Context 🔦

No response

Your environment 🌎

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    scope: menuChanges related to the menu.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions