mattpocock / xstate-catalogue

Professionally designed, interactive state machines
https://xstate-catalogue.com
MIT License
811 stars 62 forks source link

xstate-catalogue CatalogueSearcher modal keyboard shortcut `ctrl + k` conflicts with chrome and firefox keyboard default shortcuts #17

Closed AdamMescher closed 3 years ago

AdamMescher commented 3 years ago

While using a Windows 10 machine [version 19042.906], user attempts to open the "search machines" modal with the ctrl + k chord trigger the Focus Address bar for Web Search (writes "? " there) search shortcut in Firefox (Version 87.0 (64-bit))[1] and the Search from anywhere on the page address bar shortcut in Chrome (version 89.0.4389.114) [2]

macOS users do not appear to have a similar conflict.

[1] - https://support.mozilla.org/en-US/kb/keyboard-shortcuts-perform-firefox-tasks-quickly [2] - https://support.google.com/chrome/answer/157179?co=GENIE.Platform%3DDesktop&hl=en#zippy=%2Caddress-bar-shortcuts

Screen Recording
https://user-images.githubusercontent.com/6540117/113804474-d5b12680-971b-11eb-92da-a23b0cfd9764.mp4
Chrome Result Firefox Result
chrome firefox
Chrome Shortcuts Firefox Shortcuts
chrome-shortcuts firefox-keyboard-shortcuts
AdamMescher commented 3 years ago

User experience could benefit from update to default keyboard shortcut to open the search modal to something that does not conflict with default browser configuration or disabling of default behavior in Chrome and Firefox.

mattpocock commented 3 years ago

What do TailwindCSS use on Windows as their hotkey?

bemayr commented 3 years ago

What do TailwindCSS use on Windows as their hotkey?

Ok, that's interesting 🤔, they use Ctrl + K but it does not trigger the browser's search behavior... Let's see how they are doing that.

bemayr commented 3 years ago

Ok, i found the piece of code accomplishing this in TailwindCSS, they are using @docsearch/react via algolia and there it is implemented via a simple event.preventDefault()

🠖 PR incoming 👌

mattpocock commented 3 years ago

OK cool - I'm happy to close based on that