-
Notifications
You must be signed in to change notification settings - Fork 97
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
eventToHotkeyString
inconsistent shift
key behaviour on Mac
#54
Comments
eventToHotkeyString
outputs ?
as Shift+?
eventToHotkeyString
outputs ?
event as Shift+?
Moving form a convo from another repo:
Hrm that test is simulating the events though. Maybe we need to add playwright or something to that project and do some real browser tests? I will definitely test this carefully when I work on it to figure out exactly what's actually happening in the browser. |
For helpful background; in #43 @keithamus states that "on macOS the "Meta+Shift" plane is always lowercase". I just checked and this does appear to be the case This is also true of special characters I think what this means is that:
This leads me to think, that we should continue to require the |
This is all very complicated. Here are some givens:
Given
Then
Some implications from this
|
Here is my proposed "logical" hotkey format:
Examples
HumanizingWe then would want to provide a formatting function that could show the above logical representations in a human readable form. This ideally would use the humanizeHotkey("Control+Alt+Meta+Shift+Slash") === "ctrl+alt+cmd+?"
humanizeHotkey("Shift+Meta+KeyK") === "cmd+K"
humanizeHotkey("Meta+Space") === "cmd+space"
humanizeHotkey("KeyG KeyN") === "g n"
humanizeHotkey("KeyG Shift+KeyN") === "g N" This helper could take a keyboard layout (eg. DVORAK, AZERTY...) with QWERTY as default for when humanizeHotkey("Control+Alt+Meta+Shift+Slash", { layout: "DVORAK"}) === "ctrl+alt+cmd+Z"
humanizeHotkey("KeyG Shift+KeyN", { layout: "DVORAK"}) === "i B" event.code "Slash" maps to the "z" key on a DVORAK keyboard We could extend this idea to take other options. For example, we could format "Localized" shortcuts for different keyboard layoutsIt would then be to an implementer to provide alternate shortcuts to support different semantic hotkeys. For example, in order to preserve the semantics of the |
|
Another thought: what if we support both This would put us back in the same place when Update: VS Code has a similar scheme that allows distinguishing |
@khiga8 thank you! Great questions!
I also found this proposal which I quite like w3c/uievents#247 but hasn't had any activity since November 2019. |
A solution I am leaning towards is: when we encounter For example, for the hotkey
For the hotkey ... on Windows, we could produce the following trie nodes:
... and on Mac we could produce the following nodes:
I think this would allow us to be prepared for any platform inconsistencies. This would however require us to be able to map to from "uppercase" special characters — eg. from |
A separate thing I am considering is that we should support the "scan-code" square-bracket syntax from VSCode for |
eventToHotkeyString
outputs ?
event as Shift+?
eventToHotkeyString
inconsistent shift
key behaviour on Mac
eventToHotKeyString
outputs?
event asShift+?
Since the updates in the latest release which include a logic change to address a different bug,
eventToHotkeyString
is includingShift
unexpectedly.?
==>Shift+?
!
==>Shift+!
Can we revert the logic to what it was before?
Related PRs:
The text was updated successfully, but these errors were encountered: