Skip to content

[Studio UI] Add Shift+F10 keyboard trigger for context menus - #4055

Open
idaiv wants to merge 7 commits into
2026.xfrom
fix/context-menu-keyboard-trigger
Open

[Studio UI] Add Shift+F10 keyboard trigger for context menus#4055
idaiv wants to merge 7 commits into
2026.xfrom
fix/context-menu-keyboard-trigger

Conversation

@idaiv

@idaiv idaiv commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Context menus only responded to right-click — keyboard users had no access
  • Added onKeyDown handler to ContextMenuWrapper that opens the dropdown on Shift+F10
  • Centralized fix: all context menus (tree nodes, tabs, grids) inherit this behavior
  • Fixes WCAG 2.1 2.1.1 (Keyboard) — the single biggest Level A gap in the app

Test plan

  • Focus a tree node via Tab + arrow keys
  • Press Shift+F10 — verify context menu opens
  • Verify arrow keys navigate menu items
  • Press Escape — verify menu closes
  • Right-click still works as before

🤖 Generated with Claude Code

Relates to https://github.com/pimcore/product-management/issues/372

The ContextMenuWrapper only responded to right-click. Add onKeyDown
handler that opens the dropdown on Shift+F10, the standard keyboard
shortcut for context menus (WCAG 2.1 2.1.1). Centralized in the
shared wrapper so all context menus (trees, tabs, grids) benefit.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings September 1, 2026 13:56
@idaiv idaiv added the Skip Milestone Check Exempts this PR from the mandatory milestone requirement label Sep 1, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Shift+F10 handling for keyboard-triggered context menus.

Changes:

  • Opens ContextMenuWrapper on Shift+F10.
  • Prevents default handling and event propagation.

Review assessment:

  • The fix is at a shared component but misses direct Dropdown context menus, including grids.
  • Opening the menu does not transfer keyboard focus.
  • No required Storybook regression coverage was added.
  • No public API compatibility impact.
Suppressed comments (2)

assets/js/src/core/components/context-menu-wrapper/context-menu-wrapper.tsx:51

  • Opening the controlled dropdown does not transfer focus into the menu. Because Ant Design's autoFocus defaults to false, Shift+F10 leaves focus on the tree node or tab, so subsequent arrow keys continue handling the underlying control rather than navigating the menu. Pass autoFocus to the dropdown so the newly opened menu is keyboard-operable.
      setOpen(true)

assets/js/src/core/components/context-menu-wrapper/context-menu-wrapper.tsx:72

  • This is not actually centralized across the app's context menus. The asset and data-object grid menus render Dropdown directly (modules/*/listing/decorator/context-menu/.../list-grid-context-menu.tsx:37-47), and other direct trigger={['contextMenu']} consumers include image-preview.tsx:112-116, tree-element.tsx:165-172, and asset-target.tsx:103-108; none reaches this handler. Consequently the stated grid coverage—and the broader “all context menus” claim—remains unimplemented. Put keyboard triggering in a shared context-menu abstraction used by these callers, or migrate every relevant caller.
        onKeyDown={ handleKeyDown }

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +47 to +51
const handleKeyDown = (event: React.KeyboardEvent): void => {
if (event.key === 'F10' && event.shiftKey) {
event.preventDefault()
event.stopPropagation()
setOpen(true)
idaiv and others added 5 commits September 2, 2026 08:32
After opening the dropdown via keyboard, programmatically focus the
first .ant-dropdown-menu-item so ArrowDown/Up navigation works
immediately. Without this, focus stays on the trigger element.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Dispatch a synthetic contextmenu MouseEvent at the focused element's
bounding rect so Ant Design positions the dropdown correctly. Without
this, keyboard-triggered menus appeared at (0,0).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ipping

Tree and sidebar containers have overflow:hidden which clips the
dropdown when opened via keyboard. Add getPopupContainer to render
the overlay at document.body, escaping any clipped ancestors.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Sep 2, 2026

Copy link
Copy Markdown

@idaiv
idaiv requested a review from vin0401 September 2, 2026 09:14
@idaiv idaiv added this to the 2026.3.0 milestone Sep 2, 2026
@idaiv
idaiv requested a review from martineiber September 2, 2026 10:28
@idaiv idaiv removed the Skip Milestone Check Exempts this PR from the mandatory milestone requirement label Sep 2, 2026
@idaiv
idaiv removed the request for review from martineiber September 2, 2026 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants