Page MenuHomePhabricator

MenuItem with actions: improve interactions and keyboard navigation
Open, HighPublic

Description

Background

In T383909 we decided that actions can be used within a MenuItem, and we created this sandbox demo to illustrate that use case and refer back to these decisions if actions are included in MenuItems in the future. However, actions within MenuItems don't work perfectly now and they cannot be navigated using the keyboard.

Additionally, when hovering, both the MenuItem and its actions (specifically quiet buttons) are highlighted at the same time, making it unclear which one is being interacted with. Since both elements use background-interactive-subtle--hover, there is no visual distinction between them.

Grabaciondepantalla2025-02-06alas17.08.52-ezgif.com-video-to-gif-converter.gif (394×800 px, 177 KB)

We need to review how actions are included within MenuItem to solve these issues.

Design proposal

Include if needed.

Open questions

  1. Do we intend to support arbitrary interactive elements, or only specific ones?
    1. We've identified the need for quiet buttons within MenuItems - should this be the only supported action, or do we need to support more?
    2. This will inform both the design decisions and implementation.
  2. How can we provide keyboard navigation support for menu item actions?
    1. Currently, menu items are not in the normal tab order - instead, the user remains focused on the triggering element and uses the arrow keys to loop through the menu items. This arrow key support is provided in the Menu component. How can we enable navigation to and interaction with menu item actions? This might inform the answer to the previous question.

Acceptance criteria (or Done)

  • Decide which type(s) of actions/interactive elements we intend to support.
  • Differentiate hover states for MenuItem and its actions.
  • Ensure that menu item actions can be reached and interacted with via keyboard navigation.
  • Document on the Codex docs site how to include actions within menu items.

Event Timeline

bmartinezcalvo renamed this task from MenuItem with actions: improve to MenuItem with actions improvement.Feb 6 2025, 3:01 PM
bmartinezcalvo updated the task description. (Show Details)
bmartinezcalvo added subscribers: CCiufo-WMF, AnneT.
bmartinezcalvo renamed this task from MenuItem with actions improvement to MenuItem with actions: improve interactions and keyboard navigation.Feb 6 2025, 4:16 PM
bmartinezcalvo updated the task description. (Show Details)
bmartinezcalvo moved this task from Inbox to Backlog on the Design-System-Team board.
CCiufo-WMF moved this task from Backlog to Needs Refinement on the Design-System-Team board.
CCiufo-WMF added a project: Accessibility.