Implementing shortcut keys in a webpage

前端 未结 7 2182
有刺的猬
有刺的猬 2021-02-08 04:26

I was thinking of implementing shortcut keys in a pet web application, I am developing for me. I am using c# and asp.net.

I have seen very few web-sites( frankly I reme

7条回答
  •  别跟我提以往
    2021-02-08 04:55

    Mousetrap is an excellent JavaScript library for handling shortcut keys.

    Based on how I've seen other apps (Gmail, JIRA) use shortcut keys, and based on my own experience, I would make a couple of suggestions:

    • Interfering with browser shortcut keys is a real possibility. The most reliable way to avoid this is to use unmodified letters (i.e., A instead of Ctrl-A or Alt-A).
    • Keyboard shortcuts are relatively rare for web sites, so they suffer from poor discoverability. Since they're not very discoverable, you'll need to add, e.g., tooltips or unobstrusive hints letting users know that they exist. Keyboard shortcuts seem to be most useful for web applications, like Gmail and JIRA, that are expected to be used heavily; otherwise, there's just not enough opportunity or benefit to learning them.

提交回复
热议问题