Fix logical-character shortcuts on international keyboard layouts - #17892
Open
jfaltermeier wants to merge 10 commits into
Open
Fix logical-character shortcuts on international keyboard layouts#17892jfaltermeier wants to merge 10 commits into
jfaltermeier wants to merge 10 commits into
Conversation
* normalize native and transported keyboard input for direct keybinding dispatch while preserving AltGraph, legacy key identifiers, composition handling, and dispatch identity * add a toggleable developer command that logs interpreted input, normalized key codes, keyboard layout source, matched bindings, and skipped events * expose keyboard layout metadata through an RPC-safe, optional source provider for browser and Electron, with an unknown fallback * separate runtime dispatch identity from persisted keybinding serialization and add coverage for normalized input, diagnostics, layout sources, and composition filtering
* separate authored command modifiers from physical Shift and AltGraph production layers while preserving serialization and stable runtime dispatch identity * resolve printable bindings through ranked layout candidates, keep unavailable characters configured but inactive, and refresh matching when the layout or dispatch mode changes * interpret platform-specific command and production candidates so Windows AltGraph, macOS Option, shifted characters, and keyCode dispatch remain symmetric * show logical shortcut labels with deduplicated physical realizations in keymap tooltips and explain unavailable bindings * improve layout detection with raw AltGraph evidence and cover BÉPO collisions, production priority, inactive bindings, platform fallbacks, and provenance
* retain competing command and production prefixes across chords, prioritize command matches, and reject equal-priority ambiguity * track canonical and layout-derived runtime forms with provenance and report interpretation shadowing separately from ordinary collisions * canonicalize recorded shortcuts to stable logical characters, preserve required physical Shift for unsupported characters, and ignore modifier-only strokes * surface command-modifier shadowing in keymap tooltips and explain logical AltGr persistence to Windows users
* dispatch commands through normalized production-aware input while preserving pre-cancelled DOM events for capture listeners without duplicate execution * transport explicit AltGraph, composition, and location data from webviews through direct keybinding matching * register only active, Monaco-representable bindings while handling production Shift and platform-specific Ctrl/Cmd encoding * use logical shortcut labels in Monaco and add focused coverage for dispatch, transport, and adapter behavior
* expose physical formatting for resolved keybindings while preserving logical browser-menu labels and suppressing inactive physical forms * request logical accelerators in renderer menus and physical realizations for Electron, including plugin-contributed menus * validate Electron representability and omit unsupported AltGr, non-ASCII, malformed, and chord accelerators * preserve native roles and platform-specific accelerator registration behavior * carry accelerator metadata through preload and centralize native conversion with focused core, Electron, and plugin-menu coverage
* add logical-character, Unicode escape, and physical scan-code authoring with canonical recorder serialization and compatibility for existing keybinding strings * resolve printable bindings across Shift and AltGraph layers while preserving stable dispatch, inactive logical bindings, physical shortcuts, and integrations across supported execution paths * document migration and API changes, and extend coverage for layout layers, recorder persistence, scan codes, reserved characters, logical plus, inactive labels, and JSDOM compatibility
* unify dead-key filtering and layout-modifier interpretation across platforms * simplify runtime matching, accelerator formatting, and Electron menu metadata * standardize keybinding terminology, serialization, inactive state, and layout-source APIs * harden ambiguous dispatch and webview handling with focused regression coverage * document API changes, migration guidance, and the positional dispatch escape hatch
issues/13874_keybindings
jfaltermeier
force-pushed
the
issues/13874_keybindings
branch
from
August 4, 2026 10:11
63e26e4 to
cb975a8
Compare
* detect the compiled keybinding test filename regardless of path separator when toggling JSDOM * derive Monaco control-key labels from its native platform formatter instead of stubbing Theia OS detection * preserve logical punctuation and letter label coverage on macOS and non-macOS platforms
* preserve authored Ctrl and Alt modifiers when UI Events reports AltGraph without the legacy pair * resolve Ctrl+Alt-emulated AltGraph through command and layout interpretations * preserve resolved key codes during command dispatch so AltGraph bindings round-trip * cover dispatch and recorder behavior and clarify Windows AltGraph documentation
jfaltermeier
marked this pull request as ready for review
August 4, 2026 13:48
This file contains hidden or 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
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.
What it does
Fixes #13874.
Problem
Printable shortcuts previously mixed up command modifiers with modifiers needed by the active keyboard layout to produce a character.
On a German layout,
[is produced byAltGr+8. This caused two related failures:Ctrl+[savedCtrl+8.ctrl+[displayed and triggered asCtrl+Ü, following the USBracketLeftposition instead of the logical[character.As a concrete walkthrough, assign
ctrl+[tochat:open-claude-code-memory. This command has no default keybinding and is easy to use/verify.Solution
The new flow keeps authored command modifiers (
Ctrl,Alt,Shift, andMeta) separate from layout-production modifiers (Shift,AltGr, or both):KeyCodeparsing preserves the authored logical character. Authored serialization remains separate from the stable runtimedispatchString()identity.[ScanCode]and[char:...]provide explicit physical and reserved-character forms.KeyboardLayoutServiceresolves German[to physicalDigit8on the AltGr layout layer and derives platform-specific interpretations of normalized keyboard input.KeybindingRegistryresolves and caches bindings, matches normalized interpretations by runtime identity, prioritizes intentional command-modifier interpretations where necessary, and executes the selected command.ctrl+[/Ctrl+[, while its tooltip exposesCtrl+AltGr+8as the physical realization.ctrl+[ctrl+[BracketLeft[Ctrl+Üor recordedCtrl+8Digit8+ AltGr, with authored CtrlCtrl+Ü/Ctrl+8Ctrl+[Ctrl+AltGr+8matches the stable dispatch identityOther affected areas
The logical/physical distinction now consistently applies to:
Compatibility and migration
Existing
keymaps.jsonfiles and keybinding strings remain parseable. No file-format migration is required.Printable tokens now follow logical characters. Position-dependent bindings must use scan-code syntax such as
ctrl+[BracketLeft]. Reserved logical characters use character tokens such asctrl+[char:0x2B].Logical characters unavailable on the active layout remain visible but inactive instead of falling back to an unrelated US key position. Users who require global positional behavior can set:
Downstream adopters must:
KeyboardLayout.key2KeyCodeconsumers tocandidatesByCharacterorcandidatesByFoldedCharacter;transformKeyCode()andgetCharacterIndex()extension points toresolveKeyCode()and candidate lookup;KeyboardLayoutService.validateKeyCode;KeyCodeequality, modifier-only checks, authored serialization, and runtimedispatchString()usage;matchKeybinding()consumers frommatch.bindingtomatch.runtime.binding;AcceleratorSource.getAccelerator.See
packages/keymaps/README.mdfor the complete keybinding grammar anddoc/Migration.mdfor adopter details.How to test
I guess we have to test setting up and using keyboard shortcuts on different OSes with various keyboard layouts and throughout the application. Maybe testing via next builds would be suitable.
Follow-ups
Breaking changes
Attribution
Review checklist
nlsservice (for details, please see the Internationalization/Localization section in the Coding Guidelines)Reminder for reviewers