-
-
Notifications
You must be signed in to change notification settings - Fork 134
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
Add capability for KeyboardEvent.code + capture #291
Open
vidartf
wants to merge
15
commits into
jupyterlab:main
Choose a base branch
from
vidartf:kbd
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Here is what I got using a fr-fr keyboard: fr-fr layoutcodes: { "AltLeft": "Alt", "AltRight": "AltGraph", "ArrowDown": "ArrowDown", "ArrowLeft": "ArrowLeft", "ArrowRight": "ArrowRight", "ArrowUp": "ArrowUp", "Backquote": "²", "Backslash": "*", "Backspace": "Backspace", "BracketRight": "$", "Comma": ";", "ControlLeft": "Control", "ControlRight": "Control", "Delete": "Delete", "Digit0": "À", "Digit1": "&", "Digit2": "É", "Digit3": """, "Digit4": "'", "Digit5": "(", "Digit6": "-", "Digit7": "È", "Digit8": "_", "Digit9": "Ç", "End": "End", "Enter": "Enter", "Equal": "=", "Escape": "Escape", "F1": "F1", "F10": "F10", "F11": "F11", "F12": "F12", "F2": "F2", "F3": "F3", "F4": "F4", "F5": "F5", "F6": "F6", "F7": "F7", "F8": "F8", "F9": "F9", "Home": "Home", "Insert": "Insert", "IntlBackslash": "<", "KeyA": "Q", "KeyB": "B", "KeyC": "C", "KeyD": "D", "KeyE": "E", "KeyF": "F", "KeyG": "G", "KeyH": "H", "KeyI": "I", "KeyJ": "J", "KeyK": "K", "KeyL": "L", "KeyM": ",", "KeyN": "N", "KeyO": "O", "KeyP": "P", "KeyQ": "A", "KeyR": "R", "KeyS": "S", "KeyT": "T", "KeyU": "U", "KeyV": "V", "KeyW": "Z", "KeyX": "X", "KeyY": "Y", "KeyZ": "W", "Minus": ")", "Numpad0": "0", "Numpad1": "1", "Numpad2": "2", "Numpad3": "3", "Numpad4": "4", "Numpad5": "5", "Numpad6": "6", "Numpad7": "7", "Numpad8": "8", "Numpad9": "9", "NumpadAdd": "+", "NumpadDecimal": ".", "NumpadDivide": "/", "NumpadEnter": "Enter", "NumpadMultiply": "*", "NumpadSubtract": "-", "PageDown": "PageDown", "PageUp": "PageUp", "Period": ":", "Quote": "Ù", "ScrollLock": "ScrollLock", "Semicolon": "M", "ShiftLeft": "Shift", "ShiftRight": "Shift", "Slash": "!", "Tab": "Tab" } |
In preparation for changes.
This: - Adds the capability for KeycodeLayout to also use the `code` field from KeyboardEvents. - Adds a map for `code` fields for EN_US. - Adds a package with a widget for capturing keyboard layouts. - Adds an example app for capturing keyboard layouts. TODOs: - Add tests for capture widget / example. - Figure out a pattern for adding other layouts. Should they be added to keyboard package, or to one or more separate language packs?
Not 100% on if this is really needed or not.
Only export en_US directly, the rest in a collection
If we already are using a browser based layout, don't create a new one.
From discussion on the JupyterLab dev call today, the following points were discussed:
|
This avoids a new package, and the code is small enough that it fits well as an example.
Also simplifies back the modules for a smaller diff, and adjusts and fixes some smaller points.
Note:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This:
KeycodeLayout
to also use thecode
field fromKeyboardEvents
. It still allows for adding keyCode values to the map, both for backwards compatibility, but also since there are some keys that will not have acode
value (it will be either an empty string or "Unidentified").code
fields for EN_US.key
field fromKeyboardEvents
onto the list of "Special Keys" from the spec. This is only considered if there are no match for the event via thecode
/keyCode
fields.Resolves #74.
TODOs:
Add tests for capture widget / example.Find a way to explicitly prompt for a key value for "Dead" keys. This might need some extra thought to catch corner cases.We should not try to capture Dead keys, as they are unsuitable for use in shortcuts.isComposition
is relevant. Capture any behavior in tests. Conclusion: Any compose use should be handled by the caller of the API.