# Bug DREAM-1000 - ActionMenu: ArrowRight opens a disabled sub-menu item

Project: Stream Design System
Status: closed
URL: https://community.openproject.org/work_packages/DREAM-1000

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Module | Frontend components and Primer design system, Modules and project features / Backlogs |
| Target versions | 18.0.0 |
| Observed in versions | 18.0.0 |
| Sprint |  |
| Backlog bucket |  |
| Bug found in version (deprecated) |  |
| Requires doc change | No |
| Accessibility | No |
| Pull preview |  |
| List |  |
| Labels |  |

## People

| Attribute | Value |
| --- | --- |
| Assignee | Alexander Coles |
| Accountable |  |
| Product manager |  |
| Developers | Alexander Coles |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Planning

| Attribute | Value |
| --- | --- |
| Relevance |  |

## Costs

| Attribute | Value |
| --- | --- |
| Votes |  |
| Work |  |
| Labor costs |  |

## Description

## Context

A disabled `Primer::Alpha::ActionMenu::SubMenuItem` cannot be opened with the mouse, **Enter** or **Space**, but **ArrowRight** still opens its sub-menu. Keyboard users reach content that pointer users cannot.

Related: <mention class="mention" data-id="DREAM-980" data-type="work_package" data-text="#DREAM-980">#DREAM-980</mention> (**ArrowLeft** handling in the same key handler).

## Steps to reproduce

1.  Render an `ActionMenu` containing a sub-menu item with `disabled: true`, for example via `menu.with_item(component_klass: Primer::Alpha::ActionMenu::SubMenuItem, label: "Move", disabled: true)`.

2.  Open the menu and move focus to the disabled sub-menu item with the arrow keys.

3.  Press **ArrowRight**.

In OpenProject this is reachable in Backlogs: select more than 50 work package cards in one list, open the card menu, focus "Move to position", press **ArrowRight**.

## Actual behavior

The sub-menu opens.

## Expected behavior

Nothing happens, matching click, **Enter** and **Space** on the same item.

## Cause

`action_menu_element.ts` in `openproject-primer_view_components` 0.96.0:

  - `#potentiallyDisallowActivation` blocks click and keyboard activation when the item has `aria-disabled`.

  - `#handleItemKeyboardEvent`, case `'ArrowRight'`, calls `subMenu?.showPopover()` without checking `aria-disabled` on the item.

## Notes

  - Found by reading the source while planning <mention class="mention" data-id="AGILE-364" data-type="work_package" data-text="#AGILE-364">#AGILE-364</mention>; not yet reproduced in a browser.

  - Upstream `primer/view_components` no longer has nested sub-menus, so this is fork-only.

  - With **ArrowRight** bound to "next item" (<mention class="mention" data-id="DREAM-1045" data-type="work_package" data-text="#DREAM-1045">#DREAM-1045</mention>), stopping the sub-menu from opening moved focus to the next item instead. Both are fixed together: <https://github.com/opf/primer\_view\_components/pull/558>

  - OpenProject's `op-action-menu.component.ts` blocks **ArrowRight**, **Enter** and **Space** on disabled sub-menu items itself (`opensDisabledSubMenu`); it can go once the fix is released.

## Environment

`openproject-primer_view_components` 0.96.0
