-
-
Notifications
You must be signed in to change notification settings - Fork 135
Format keyboard shortcuts according to OS conventions #258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This reverts commit 57a6ee7. It was not clear in issue jupyterlab#151 calling for a change in formatting of arrows that arrows should not be treated as modifier keys.
…rm conventions. Fixes jupyterlab#151
00d4249
to
9eb54e8
Compare
const MAC_DISPLAY: { [key: string]: string } = { | ||
Backspace: '⌫', | ||
Tab: '⇥', | ||
Enter: '↩', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⏎ might have a closer semantic meaning, but will often render as a less familiar icon
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In VoiceOver, your character ⏎ is read as "return symbol", whereas the one in the PR (↩) is read as "return" (when they are in the place of keyboard shortcuts on a menu). I think the one in the PR is the official one to use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, especially for the current use case of displaying the shortcuts as labels.
For better accessibility we could implement aria-keyshortcuts. I guess that would be another function taking the keystroke and returning the aria-label (or maybe formatKeystroke
could return both {label: string, aria: string}
in a future major version). If it makes sense I will open a new issue to track this accessibility improvement.
+1 Huh, the Aria Shortcuts document seems to vindicate a decision we made about how shortcuts are specified that sometimes people call us out on as controversial or confusing:
For example, we don't say a shortcut is |
Thanks for the review @krassowski! |
Fixes #151
Fixes #255
Closes #256
This formats keyboard shortcuts to OS conventions on Windows and macOS. It reverts #252 and supersedes #256.
I checked with VoiceOver, and it appears that these glyphs are recognized correctly on Catalina when speaking shortcuts on menu items, etc. (i.e., the curvy arrow is correctly pronounced "return" when reading the keyboard shortcut). I pulled the Windows formatting conventions by looking at how custom keyboard shortcuts are formatted in Microsoft Word (IIRC), but it would be good to double-check those.