ui icon indicating copy to clipboard operation
ui copied to clipboard

Does the Command component work for windows?

Open dBianchii opened this issue 2 years ago • 3 comments

I see that the command component in the docs is using the mac command icon ⌘. However, even for functionality, I can't get it to work with cntrl or shift.

Was it supposed to work on windows? If so, how can I get it to work?

dBianchii avatar May 04 '23 00:05 dBianchii

On Windows the META key is the Window (⊞) key. On Mac machines the META key is the Cmd (⌘) key I encountered the same problem specifically when I used the Chrome browser, for some reason the shortcut dose not work, but I found solution to the problem by changing the shortcut to this const down = (e: KeyboardEvent) => { if (e.ctrlKey && e.shiftKey && e.key === "k") { setOpen((open) => !open); } }; and it work

Right now I am looking for the reason it dose not work with the shortcut (e.key === "j" && e.metaKey)

MohamedMujtaba avatar May 09 '23 17:05 MohamedMujtaba

@MohamedMujtaba cntrl + k opens up Chrome's search bar. How did you fix it?

I tried using e.preventDeafult() but this breaks and I can't use my keyboard to type anymore

dBianchii avatar May 09 '23 18:05 dBianchii

@dBianchii not just cntrl + k replace your if statement with this (e.ctrlKey && e.shiftKey && (e.key === "k" || e.key === "K"))

MohamedMujtaba avatar May 10 '23 08:05 MohamedMujtaba

This issue has been automatically closed because it received no activity for a while. If you think it was closed by accident, please leave a comment. Thank you.

shadcn avatar Jul 03 '24 23:07 shadcn