[FEATURE] Change default behavior for closing on clicking a command through the mouse
See original GitHub issueIs your feature request related to a problem? Please describe.
I’m adding a command to the command palette, named “Focus Search Bar”, that, when used, would focus a third-party search bar text box in the DOM (using a ref). It works well when I just use the keyboard and press enter on the option, the command palette closes automatically, and the text box remains focused. But, when I use the mouse, the command palette does not close on pressing on the command element, and though the search input is focused, the command palette is still open and upon closing, the focus from the text box is lost 😢.
Describe the solution you’d like
Though this could be achieved using the setOpen
hook, it becomes repetitive in case we need the closing behaviors through mouse click in multiple commands, and I think this would be a very typical use case where this would option need to be customized.
I could think of a config option to implement this:
- Providing a boolean option in the config to automatically close the palette upon clicking on a palette command using the cursor, just like how it closes on using a command through the keyboard enter key.
Describe alternatives you’ve considered
The only alternative I could try is to wait or maybe edit the kmenu code 🙂
Additional context
None
Issue Analytics
- State:
- Created a year ago
- Comments:5 (4 by maintainers)
Top GitHub Comments
Hey, @Just-Moh-it, I wanted to work on this tomorrow. Would an option that you can toggle on the Command type called
closeOnComplete
be a good enough fix for this situation? Do you have anything else in mind?Oh yes. @Just-Moh-it I understand what you mean now. I will for sure re-open and begin working on this because I had it on my checklist.