绑定哪个键以避免与本机浏览器快捷方式冲突 [英] Which key to bind to avoid conflict with native browser shortcuts
问题描述
我还没有看到这个问题。
每个浏览器都有不同的本机键盘快捷方式。如果我们想在我们的网络应用程序中添加一些辛辣的东西,有人已经试图找出哪一个免费/安全吗?
I didn't see the question yet. Every browser has different native keyboard short-cuts. Did someone already tried to figure out which one free / safe to use if we want to add some spicy stuff to our web-app?
更多信息:
我并不特别需要定位每个浏览器。 5个专业就足够了。例如,Opera使用 Ctrl + key 作为主要组合,几乎所有 Alt + 键可以自由绑定 。
I don't especially need to target every browser. The 5 majors one are sufficient. For example Opera uses Ctrl + key as main combination, leaving almost all Alt + key "free to bind".
由于不同的浏览器使用不同的主快捷键激活密钥(Opera中的 Ctrl ),我可以很容易想象也使用不同的密钥来绑定快捷方式。 Opera中的 Alt + Key 和browser_2中的 Ctrl + Key 和 Ctrl +浏览器3中的 Alt 。
As different browsers uses a different main shortcut activation key (Ctrl in Opera), I can easily imagine to also use a different key to bind shortcuts to. i.e Alt + Key in Opera and Ctrl + Key in browser_2 and Ctrl + Alt in browser 3.
推荐答案
如果您只需要具有焦点的表单元素之外的键盘快捷键,我会使用普通字母(没有 Ctrl / Alt / Shift /等)。如果表单元素具有焦点,则常规字符仅对浏览器很重要。否则它们会被忽略。
If you only need keyboard shortcuts outside of form elements having focus, I would use plain letters (no Ctrl / Alt / Shift / etc.). Regular characters are only important to the browser if a form element has focus. Otherwise they're ignored.
例如,如果你有分页内容, P 可能是先前的, N 可能是下一个。
For example, if you have paginated content, P could be previous and N could be next.
(不确定这是否能完全解决您的问题,因为当表单元素具有焦点时这不起作用。)
(Not sure if this would completely solve your problem because this won't work when a form element has focus.)
根据您的评论(焦点将在textarea内),我建议为每个动作选择一个单独的字母,使用不同的 Ctrl每个浏览器 / Alt / Shift 组合。大多数人只使用一个浏览器,因此对于每个用户来说,只学习他们自己的组合并不是什么大问题。
Based on your comment (the focus will be inside a textarea), I would suggest a single letter chosen for each action with a different Ctrl / Alt / Shift combination per browser. Most people only use one browser, so for each user to learn just their own combination isn't a big deal.
所以,例如, Ctrl 一个浏览器中的kbd> + Alt + N 可能与另一个浏览器中的 Alt + N 相同。
So, for example, Ctrl + Alt + N in one browser might be the same as Alt + N in another.
我要测试的第一件事是 Shift ,因为大多数内置组合不使用一个,但我不知道如果组合总是不区分大小写。还要注意特定于操作系统的组合。
The first thing I would test, though, is Shift, because most built-in combinations don't use one, but I don't know if the combos are always case-insensitive. Also watch out for OS-specific combos.
这是我发现目前为止最常见的产品:
Here's what I've found mostly available so far:
OS X - FF/Safari/Chrome - ctrl-[key]
Windows - FF/IE - ctrl-alt-[key]
这篇关于绑定哪个键以避免与本机浏览器快捷方式冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!