question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[FEATURE] Change default behavior for closing on clicking a command through the mouse

See original GitHub issue

Is 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:closed
  • Created a year ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
harshhhdevcommented, Aug 4, 2022

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?

1reaction
harshhhdevcommented, Aug 1, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What are the default buttons and wheel assignments for my ...
List of all button assignment options ; Close. Closes the active document or window. ; Copy (CTRL+C). Copies the selected text or item...
Read more >
How to Fix a Mouse That Double-Clicks on a Single Click in ...
Under this, the default behavior is Double-click to open an item (single-click to select). If you have Single-click to open an item (point...
Read more >
Change the behavior of the modifier keys on Mac
Click Keyboard Shortcuts on the right, then select Modifier Keys in the list on the left. For each modifier whose default action you...
Read more >
Handling Events :: Eloquent JavaScript
When clicked with the right mouse button, the handler for the button calls stopPropagation ... Many events have a default action associated with...
Read more >
Shortcuts - Opera Help
Command the browser with your mouse · Go to Settings. · Click Advanced in the left sidebar, and click Browser. · Under Shortcuts,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found