What are cross-browser and cross-OS safe keyboard shortcuts usable for web application?

后端 未结 4 1671
独厮守ぢ
独厮守ぢ 2021-02-01 13:27

I am developing a quite large web application, and it is probably a good idea to use hotkeys for some common tasks. However, I discovered that finding safe key combinations is a

4条回答
  •  轮回少年
    2021-02-01 13:58

    I wouldn't count on it. It's probably okay to listen for shortcuts that use the Alt modifier, but there's still no way to be sure a keyboard shortcut is free. Users can always install programs that listen for keyboard shortcuts, or use a browser you didn't expect.

    If the shortcuts can be used only when the user is not typing in a textbox or something, it might be a better idea to just listen for keys pressed without a modifier key.

    If no textbox or other GUI element is focused, then document.activeElement == document.body should be true (somebody correct me if I'm wrong).

提交回复
热议问题