Repository navigation
Description
What happens
With #943, App menus opened with the pointer leave the keyboard with the app in front, so VS Code runs the item you choose. A menu opened from the keyboard, after StableBar --focus, still takes the keyboard on purpose so you can move through it. When you then choose an item, StableBar's popup is still the key window, so VS Code likely drops the command, as it did for every App menus item before #943 (#941).
This comes from reading the code and from #941's evidence. It hasn't been reproduced by hand yet.
Steps to reproduce
- Add an App menus widget, and bind
StableBar --focusto a key. - Bring VS Code to the front, and set its log level to Trace ("Developer: Set Log Level…").
- Press the key bound to
--focus, move to File with the arrow keys and press Return. - Tab to New Text File and press Return or Space.
Expected
The command runs in VS Code, as it does from a native menu opened with Control-F2 and from App menus opened with the pointer.
Environment
mainwith fix: leave the keyboard with the app while StableBar shows its menus #943 (fix for Choosing an app menu item does nothing in VS Code because StableBar's menu takes the keyboard #941) merged- Found in review of fix: leave the keyboard with the app while StableBar shows its menus #943, on macOS 27.2.1 with VS Code 1.147.0
Evidence
Without #943, VS Code logged this line at Trace level for every App menus item (#941):
menubar#runActionInRenderer: no active window found {"type":"keybinding","userSettingsLabel":"cmd+n"}
Diagnosis
WidgetPopupsetsleavesKeyboard = !window.isKeyWindowon an app menu popup (and on the tray inshowRow). Under--focus,BarPanel.focusWidgets()has made the bar key, so the popup keepscanBecomeKeyand becomes key when it opens.AppMenu.press(_:)sendskAXPressActionon a detached task right away. Nothing gives the keyboard back to the app in front first, so it has no key window when the press arrives.- A fix should keep keyboard navigation in the menu (Use the bar with VoiceOver and the keyboard #212, Popup sliders, toggles, segmented controls, the chooser and text fields show no keyboard focus #517). For example, StableBar could close the popup and give up the keyboard before the press, then wait until the app has a key window again.
Related
- Choosing an app menu item does nothing in VS Code because StableBar's menu takes the keyboard #941, fix: leave the keyboard with the app while StableBar shows its menus #943: the same problem for menus opened with the pointer. fix: leave the keyboard with the app while StableBar shows its menus #943 left this case out on purpose, and its review agreed to follow it up separately.
- Clicking a submenu item from the App menus tray closes the menus without choosing it #942, fix: choose a submenu item opened from the App menus tray #944: clicks in a submenu opened from the App menus tray.
Triaged by Claude Code (Claude Opus 5.5).
Activity