From c41e173a639541b27080c9aed34e67740d3afd8d Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Sun, 11 Jan 2026 07:19:56 -0800 Subject: [PATCH] Fix dropdown menu hotkeys not working when menu is closed The nested menu PR introduced an early return null when !isOpen, which prevented MenuItemHotKey components from being rendered. Fixed by extracting hotKeyElements and rendering them even when the menu is closed. --- src-web/components/core/Dropdown.tsx | 33 +++++++++++++++------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src-web/components/core/Dropdown.tsx b/src-web/components/core/Dropdown.tsx index 69dc6825..0a50fe1e 100644 --- a/src-web/components/core/Dropdown.tsx +++ b/src-web/components/core/Dropdown.tsx @@ -766,8 +766,24 @@ const Menu = forwardRef ); + // Hotkeys must be rendered even when menu is closed (so they work globally) + const hotKeyElements = items.map( + (item, i) => + item.type !== 'separator' && + item.type !== 'content' && + !item.hotKeyLabelOnly && + item.hotKeyAction && ( + + ), + ); + if (!isOpen) { - return null; + return <>{hotKeyElements}; } if (isSubmenu) { @@ -776,20 +792,7 @@ const Menu = forwardRef - {items.map( - (item, i) => - item.type !== 'separator' && - item.type !== 'content' && - !item.hotKeyLabelOnly && - item.hotKeyAction && ( - - ), - )} + {hotKeyElements} {menuContent}