Some thoughts regarding KeyboardShortcut component
See original GitHub issueđ Bug report
Current behavior
KeyboardShortcut component seems to make multiple assumptions that seem specific to usage in our codebases, to web, to English locale, and more. In particular, it remaps CMD to CTRL on platforms other than macOS.
The problem is that this is not enough to meet platform conventions. On macOS, SHIFT should be first, and only replacing characters without reordering them does not result in display following platform guidelines. CMD + SHIFT + 1
renders as Ctrl Shift 1
on Windows and â ⧠1
on macOS, but it should be ⧠â 1
on macOS.
Other potential issues:
- are we 100% sure that keys are always named âCtrlâ and âShiftâ in other locales? I know that some e.g. German locales used âStrgâ instead of âCtrlâ
Possible solutions
The component could only do rendering, and leave all other decisions to the caller.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
Everything You Always Wanted to Know about Keyboard ...
To this day, some people live by keyboard shortcutsâon Windows it's Control C for Copy, Control V for pasteâand others use the mouse....
Read more >Keyboard shortcuts in Word - Microsoft Support
Select the first or last cell in the row, and then press Shift+Alt+End or Home. Select the whole table. Alt+5 on the numeric...
Read more >Understanding Success Criterion 2.1.4: Character Key Shortcuts
A mechanism is available to remap the shortcut to include one or more non-printable keyboard keys (e.g., Ctrl, Alt);; Active only on focus:...
Read more >Teaching Students About Keyboard Shortcuts | Edutopia
Sometimes we do it without thinking. A quick Ctrl + Z if we want to undo a word we typed. But where did...
Read more >Keyboard shortcuts - IBM
Action Windows Apple
Copy Ctrl+C Command+C
Cut Ctrl+X Command+X
Paste Ctrl+V Command+V
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I donât think this is the way to go. Shortcuts could just as well be dynamic (configurable by the user), could change by browser (to avoid clashes) etc. I think itâs much easier to replace shortcuts on client level (e.g. the way we do here by replacing the whole keymap or tweaking some of the constants).
@proxi I canât find a similar guideline on the order for Windows, but e.g. look at some official shortcuts here: https://support.microsoft.com/en-us/windows/keyboard-shortcuts-in-windows-dcc61a57-8ff0-cffe-9796-cb9706c75eec
A common pattern is for Shift to come second: Ctrl + Shift Alt + Shift
In general, most shortcuts only use 2 modifiers Windows + Alt Windows + Shift Ctrl + Alt etc.
although sometimes, three appear too
Windows key always goes first. So, my not very scientific deduction of order would be, more or less (itâs somewhat flexible):
Windows, Ctrl, Alt, Shift