英文:
Accessible hotkeys for superscript and subscript
问题
我想在我的Web应用程序中的所见即所得文本编辑器中添加文本的上标或下标功能,并且需要为其设置热键。像Microsoft Word这样的流行编辑器使用<kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>=</kbd>来表示上标,以及<kbd>Ctrl</kbd>+<kbd>=</kbd>来表示下标,但我不能使用这些,因为它们会触发浏览器的本地缩放。当然,我已经为上标和下标分别添加了按钮,并且将添加提示,但我仍然希望使热键尽可能方便。是否有其他常见的组合用于这些功能?
英文:
I want to add a feature of making text super- or subscript to a WYSIWYG text editor in my web application and I need to set up hotkeys for it. Popular editors like Microsoft Word use <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>=</kbd> for superscript and <kbd>Ctrl</kbd>+<kbd>=</kbd> for subscript, but I can't use those since they trigger browser native zoom. Of course, I have separated buttons for super- and subscript and I will add hints to them, but I'd still like to make hotkeys as convenient as possible. Is there another common combination for these features?
答案1
得分: 0
替代热键
<kbd>Ctrl</kbd> + <kbd>.</kbd> 用于上标,<kbd>Ctrl</kbd> + <kbd>,</kbd> 用于下标,这些都是可以接受的替代方式(分号和逗号)。它们是Google Docs默认设置的,因此熟悉度相对较高。
辅助功能考虑
您不能假设任何键都是“安全”的,因为人们可能根据自己的喜好更改热键。
因此,您应该始终为人们提供在设置菜单中自行更改快捷键的选项(该设置菜单应易于访问)。
您还应该为人们提供开启和关闭热键的选项(同样,使该切换热键可根据其喜好进行自定义)。
很多时候,人们因为使用与屏幕阅读器热键重叠的热键而遇到问题,导致热键无法正常工作,因此在实施热键之前,请确保考虑上述情况。
还要确保清楚地说明每个项目设置的热键(不仅对视觉用户,还对屏幕阅读器用户)。
英文:
Alternative Hotkeys
<kbd>Ctrl</kbd> + <kbd>.</kbd> for superscript and <kbd>Ctrl</kbd> + <kbd>,</kbd> for subscript are acceptable alternatives. (full stop / period and comma). They are the defaults set for Google Docs so familiarity will be reasonably high.
Accessibility Considerations
You cannot assume that any key is 'safe' as people may change their hotkeys to their preference.
For this reason you should always give people the option to change shortcut keys themselves in a settings menu (which should be easy to access).
You should also give people the option to toggle hotkeys on and off (yet again making the hotkey for that toggle customisable to their preference).
A lot of the time people come unstuck because they use a hotkey that overlaps with a screen reader hotkey and the hotkey doesn't work so make sure you consider the above before implementing hotkeys.
Also make it clear what hotkey is set for each item (to both sighted and screen reader users).
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论