[Studio UI] Add Shift+F10 keyboard trigger for context menus - #4055
Open
idaiv wants to merge 7 commits into
Open
[Studio UI] Add Shift+F10 keyboard trigger for context menus#4055idaiv wants to merge 7 commits into
idaiv wants to merge 7 commits into
Conversation
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>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Shift+F10 handling for keyboard-triggered context menus.
Changes:
- Opens
ContextMenuWrapperon Shift+F10. - Prevents default handling and event propagation.
Review assessment:
- The fix is at a shared component but misses direct
Dropdowncontext 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
autoFocusdefaults 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. PassautoFocusto 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
Dropdowndirectly (modules/*/listing/decorator/context-menu/.../list-grid-context-menu.tsx:37-47), and other directtrigger={['contextMenu']}consumers includeimage-preview.tsx:112-116,tree-element.tsx:165-172, andasset-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) |
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>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
onKeyDownhandler toContextMenuWrapperthat opens the dropdown on Shift+F10Test plan
🤖 Generated with Claude Code
Relates to https://github.com/pimcore/product-management/issues/372