I am currently working on a status bar app on macOS, After the user opens the bar menu by press shortcut key and entered a submenu, I want to use the ESC key to collapse a submenu, but I can't found a solution to collapse a submenu programmatically anywhere.
How to collapse a submenu(NSMenu) programmatically on macOS
Could you explain more in detail.
I tested a MacOS App (not a status bar app).
I click on Menu in the bar, it displays
I type ESC, that hides the submenu.
I tested with Apple menus like Time or keyboard, work the same.
-> Is it the same for you ?
Hi @Claude31
thanks for your reply, I think you just test the 1 level menu, but if you test 2 level menu, you found ESC will close all menu, I just want close current level submenu.
Seem no solution for that. I give up to do that. thanks for your attention, if you have any solution, Please share with me, thanks.
Hi @Claude31
Sorry I've confused you.
Example in Safari menu bar:
but I want only close Favorites submenu.
Sorry I've confused you.
Example in Safari menu bar:
open menu Safari -> Bookmarks -> Favorites
focus mouse on submenu Item in Favorites,
press ESC ,
but I want only close Favorites submenu.