绑定哪个键以避免与本机浏览器快捷方式冲突? [英] Which key to bind to avoid conflict with native browser shortcuts?

查看:71
本文介绍了绑定哪个键以避免与本机浏览器快捷方式冲突?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每个浏览器都有不同的本机键盘快捷键.如果我们想在网络应用中添加一些辛辣的东西,哪些是免费/安全使用的?

Every browser has different native keyboard shortcuts. Which ones are free / safe to use if we want to add some spicy stuff to our web-app?

其他信息:

我不需要特别针对每个浏览器.五个专业之一就足够了.例如,Opera通常使用 Ctrl + key ,几乎所有 Alt + key 都可以自由绑定".

I don't especially need to target every browser. The five majors one are sufficient. For example, Opera commonly uses Ctrl + key, leaving almost all Alt + key "free to bind".

由于不同的浏览器使用不同的主修饰符(Opera中的 Ctrl ),我可以轻松想象使用不同的键将快捷方式绑定到该修饰符.即Opera中的 Alt + Key ,浏览器2中的 Ctrl + Key + Alt 在浏览器3中,等等.

As different browsers use a different main modifier (Ctrl in Opera), I can easily imagine using a different key to bind shortcuts to. i.e Alt + Key in Opera, Ctrl + Key in browser 2, Ctrl + Alt in browser 3, etc.

推荐答案

如果您只需要具有焦点的表单元素之外的键盘快捷键,则可以使用纯字母(没有 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.)

根据您的评论(重点将在文本区域内),我建议为每个操作选择一个字母,并使用不同的 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 + 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆