Minor change for handleMenuItemClick
See original GitHub issueIssue Description
There is a simple change which can be made to allow for more dynamic decisions as to whether to hide the header menu for a given command.
In plugins/headerMenu.js
For the handleMenuItemClick function:
hideMenu() is called prior to checking whether there is a command.
This means every time you click a menu option the menu closes.
If you move hideMenu after the if block and wrap it as follows:
if(!e.isDefaultPrevented) {
hideMenu();
}
The result is the menu will only be hidden if a developer doesn’t use e.preventDefault() in the onCommand handler.
onCommand: (e: Event, args: MenuCommandItemCallbackArgs) => {
e.preventDefault();
// do stuff that will not close the window.
}
This would also mean a developer’s could decide whether to prevent the default depending on the command that is being handled.
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
NavigationView handle menu item click - android
How to handle menu item clicks on NavigationView in Main Activity? NavigationView navigationView = findViewById(R.id.nav_view);. I am using " ...
Read more >Control whether Menu closes on Menu.Item click #1122 - GitHub
Hi there! I have a use case for the Menu component where I don't necessarily want the Menu to close when I click...
Read more >How to handle click on a programaticaly added menu item ...
Hello, I am programmatic adding menu items in my application menu (using CMenu->InsertMenuItem). My problem is: how do I tell the app to ......
Read more >How to handle the Menu Item Click event for the newly added ...
Hi Team, Could you please tell me how to handle the Menu Item Click event for the newly added Context Menu Item. When...
Read more >Menu - Syntax & Usage - AutoHotkey
The Menu command creates, deletes, modifies and displays menus and menu items, changes the tray icon and its tooltip, or controls whether the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
thanks @ghiscoding maybe better if you do it…
done… and I went further and applied it to all plugins with menu that I found (4 of them) to have such behaviors.