可用于Web应用程序的跨浏览器和跨OS安全键盘快捷键是什么? [英] What are cross-browser and cross-OS safe keyboard shortcuts usable for web application?

查看:62
本文介绍了可用于Web应用程序的跨浏览器和跨OS安全键盘快捷键是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个非常大的Web应用程序,将热键用于一些常见任务可能是一个好主意.但是,我发现,对于所有不同的浏览器和操作系统,找到安全的按键组合都是个问题.

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 problem, regarding all different browsers and OSes.

例如,Chrome浏览器的热键列表如此之长,以至于无法尝试对我的Web应用程序使用某种逻辑热键方案-例如 Ctrl + 1 Ctrl + 2 Ctrl + 3 等.

For example, Chrome has such a long list of hotkeys that trying to use some kind of logical hotkeys scheme for my web application is impossible - e.g. Ctrl + 1, Ctrl + 2, Ctrl + 3, etc.

您是否可以在Web应用程序中使用一些安全热键备忘单,而不必担心会受到浏览器或操作系统的干扰?

Do you have some cheat sheet of safe hotkeys which can be used in a web application and not worry about some browser or OS interference?

推荐答案

我不会指望它.侦听使用 Alt 修饰符的快捷方式可能是可以的,但是仍然无法确保键盘快捷键是免费的.用户始终可以安装侦听键盘快捷键的程序,或者使用您不需要的浏览器.

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.

如果没有重点关注文本框或其他GUI元素,则document.activeElement == document.body应该为true(如果我错了,请纠正我).

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

这篇关于可用于Web应用程序的跨浏览器和跨OS安全键盘快捷键是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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