pacocoursey / cmdk

Fast, unstyled command menu React component.
https://cmdk.paco.me
MIT License
9.17k stars 262 forks source link

Disable select item with mouse #116

Closed joaom00 closed 5 months ago

joaom00 commented 1 year ago

As discussed in #49 keyboard-only item selection is the new default. I didn't add a prop to enable mouse selection because this can be implemented by the consumer if he wants to. What do you think?

I think the only problem here is that the mouse selection style will break for users so would this be a breaking change?

Adding a new prop disablePointerSelection to disable item selection via pointer events

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
cmdk-website ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 30, 2024 3:45am
phil-loops commented 1 year ago

Played around on the demo site in safari. Seems to have solved a big chunk of the woes on that browser!

What would you think of having the mouse behavior controlled by a new prop? Might be able to keep the old styling, but enable new opt-in behavior.

joaom00 commented 1 year ago

I'm in favor of letting the user make the selection with mouse but it can require a slight boilerplate so enabling this behavior with a prop is not a bad thing. I believe that the correct approach here is to disable the mouse selection with a prop and make this the default in a future v1 release

trymbill commented 1 year ago

Would love to see this merged. Feels a lot more intuitive and less prone to accidental selections.

joaom00 commented 1 year ago

@pacocoursey would like to know what you think!

Just-Moh-it commented 4 months ago

@pacocoursey not sure if this made it to the 0.2.1 release. Seems like this was merged the same day the release 👀