我可以安全地使用哪些密钥来访问我的网站?
更新:得到了一个漂亮的应用程序,每个视图都有专属快捷方式,全部是 JavaScript。 我要研究 Fogbugz,我喜欢悬停的快捷代码,感谢您的参考。
我想让我的网站对访问者来说更易于访问和使用。 我可以安全地使用哪些键码来处理某些 JavaScript 操作?
安全是指:
- 不会因默认浏览器操作而中断的键码
- 没有直接功能(例如按 F1 获取帮助)
- 没有间接功能(例如按 Ctrl + C 进行复制)
或者我应该阻止执行默认操作?
update: Got a beautiful app with exclusive shortcuts for every view, all javascript. I'm gonna look into Fogbugz, i like the hovering shortcut-codes, thanks for the reference.
i want to make my site accessible and more usable for visitors. Which keyCodes can I safely use to handle certain javascript actions?
With safely I mean:
- keyCodes that don't interrupt with default browser actions
- No direct functionality (like pressing F1 for Help)
- No indirect functionality (like pressing Ctrl + C for Copy)
Or should I prevent default actions from executing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我个人避免在面向公众的网站上使用这些键码或 AccessKey,因为无法知道您是否与用户软件(如屏幕阅读软件等)中的某些预定义快捷方式发生冲突。
I personally avoid using these keycodes or AccessKeys for a public-facing site, as there is no way to know whether you are conflicting with some predefined shortcuts in users' software like screenreading software, etc.
也许您应该看看这些问题:
Web 应用程序中的关键快捷键
构建可通过键盘访问的 Web 应用程序
Maybe you should take a look at those questions:
Key Shortcuts in Web Application
Building a keyboard-accessible web application
您想要实现什么可访问性?
像辅助功能软件一样会有自己的按键操作。
不同的浏览器有自己的按键操作。
有些甚至是可定制的。
我认为无论你做什么都是自找麻烦。
编辑:好的,所以不知何故这还不清楚。 这就是我想说的:
浏览器和辅助软件对于使用组合键有无限的可能性。 如果您尝试捕获组合键,则会干扰沿线某个地方的组合键。
叹。
What accessibility do you want to achieve?
Accessibility software like will have their own key-actions.
Different browsers have their own key-actions.
Some are even customisable.
I think you're asking for trouble whatever you do.
Edit: OK so somehow this wasn't clear. Here's what I was trying to say:
Browser's and accessibility software have an unlimited range of possibilities for what key combinations might be used. If you try to catch key-combinations, you will interfere with those somewhere along the line.
Sigh.
只需坚持字母和数字即可。
以下是 gmail 使用的快捷方式的链接,例如:-
http://mail.google.com/ support/bin/answer.py?hl=en-uk&answer=6594
只需确保您不会干扰人们在表单字段中输入内容即可。
Just stick to letters and numbers.
Here is a link to the shortcuts gmail uses for example:-
http://mail.google.com/support/bin/answer.py?hl=en-uk&answer=6594
Just make sure you don't interfere with people typing into form fields.
您还会很高兴了解 W3 的 WCAG 和 WCAG 2.0 的存在,以帮助您完成无障碍任务。
You'll also be happy to know about the existance of WCAG and WCAG 2.0 from W3 to help you with your accessibility mission.
从长远来看,这可能是一个需要解决的棘手问题,因为浏览器有时会在较新的版本中引入新的键盘快捷键,这可能与您可能已分配在应用程序中使用的快捷键发生冲突。 我知道的几个这样的例子:
旧版本的 Google 工具栏在 Firefox 1 中运行时,使用按键 Alt+s 将焦点设置到工具栏上的“搜索”字段。 然而,当 Firefox 2 推出时,历史菜单添加了 Alt+s 访问键,这打破了 Google 工具栏 Alt+s 键盘快捷键。 (更多信息)
旧版本的 Firefox 扩展 重复选项卡 使用键盘快捷键 Ctrl + Shift + T 复制当前选项卡。 然而,Firefox 2 引入了一项新功能,“重新打开最近关闭的选项卡”,并将其分配给 Ctrl + Shift + T,这打破了重复标签。 Duplicate Tab 的作者最终将“duplicate tab”快捷键更改为 Ctrl + Shift + U。 (更多信息)
This may be a tricky problem to solve over the long term, since browsers will sometimes introduce new keyboard shortcuts in newer versions, which may conflict with shortcuts that you may have assigned for use in your application. A couple of such examples that I'm aware of:
An old version of the Google Toolbar that ran in Firefox 1 used the keystroke Alt+s to set the focus to the Search field on the toolbar. However, when Firefox 2 was introduced, the History menu was added with an accessor key of Alt+s, which broke the Google Toolbar Alt+s keyboard shortcut. (More info)
An old version of the Firefox extension Duplicate Tab used the keyboard shortcut Ctrl + Shift + T to duplicate the current tab. However, Firefox 2 introduced a new feature, "reopen recently closed tab," and assigned that to Ctrl + Shift + T, which broke Duplicate Tab. The author of Duplicate Tab ended up changing the "duplicate tab" shortcut key to Ctrl + Shift + U. (More info)