Repository navigation
fix(web): a layout symbol on a letter key records as that letter - #36532
farseenmanekhan1232 wants to merge 2 commits into
Conversation
A layout can type "." on KeyH while the dedicated Period key also types ".", and both chords recorded as the same shortcut: a mod+. binding fired on both keys and mod+h could not be bound at all (pingdotgg#35787). A non-letter layout symbol on a Key[A-Z] code now resolves as that letter, so the letter key records and matches apart from the punctuation key that owns the symbol. Alt-modified symbols and an unshifted "+" keep the layout symbol, and the desktop preview guest's inlined matcher follows the same rule.
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — Shortcut recording and matching now distinguish symbols typed on letter keys from dedicated punctuation keys, consistently across the app and embedded previews. The change is limited to keyboard-layout interpretation and leaves configured defaults and existing event guards unchanged. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
Note Written by merged current main into the existing head without rebasing. resolved the html bootstrap conflict by keeping main's label-focus handler and the contributor's layout-symbol matcher. the diff against main stays at 8 files, 134 additions and 5 deletions. verified in the real chrome client, settings records ctrl + |
|
Note Written by Verified in a real dev environmentverified unchanged head created a real git project through the app and completed a codex used trusted chrome cdp key events matching the reported layout: ctrl held,
before, main records the h-key chord as after, the same chord records the dedicated period key keeps recording: h opens/closes the terminal, period hides/shows the sidebar, then plain symbol input types text: Not verifiedphysical custom xkb/wayland input, native electron preview guest forwarding, macos option input, windows, ios/android, and remote/relay/tunnel connections. this vm verification used chrome's trusted event injection with the issue's exact key properties; it did not exercise a physical custom keyboard layout. |
|
This PR conflicts with See the conflict window. |
|
Closing: this PR still conflicts with To continue, rebase the branch and open a new PR that links this one. See the conflict window. |





Problem
A keyboard layout can type
.on the physical H key while the dedicated Period key also types.. Chromium reports both askey="."(differing only incode:KeyHvsPeriod), and both chords recorded as the same shortcut: amod+.binding fired on both keys, andmod+hcould not be bound at all.Change
A non-letter layout symbol on a
Key[A-Z]code now resolves as that letter:letterKeyForLayoutSymbolinpackages/shared/src/keybindingMatching.tsreturns the code's letter when the layout key is a single non-letter, non-number character and no Alt is held; an unshifted+keeps the zoom-key behavior.shortcutKeyFromEventandresolveEventKeysuse it, so the letter key records and matches as its own letter while the dedicated punctuation key keeps the symbol. Alt-modified symbols (macOS Option glyphs) keep the layout symbol, and non-Latin layouts still match by physical code.packages/shared/src/htmlRender.tsfollows the same rule.recordedLayoutShortcutKeyinKeybindingsSettings.logic.ts) records the letter, so Settings no longer shows two identicalmod+.bindings for two different keys.Scope
Fixes #35787. No contracts, server, or mobile changes; the shared helper is re-exported for the settings logic only.
Verification
2e0bd97e8and pass here — recording fails withexpected 'mod+.' to be 'mod+h', and matching withexpected 'thread.next' to equal 'thread.previous'(themod+.binding fired on the letter key). 86/86 acrosskeybindings.test.ts,KeybindingsSettings.logic.test.ts,keybindingsFocus.test.ts, andhtmlRender.test.ts;vp run check:changedclean.vp run scenarios:prove scripts/scenarios/keybinding-layout-symbol-records-letter.e2e.ts --base 2e0bd97e8reportsProven: the scenario fails on base 2e0bd97e86 and passes on head. The scenario signs into the real app, opens Settings → Keybindings, and dispatches the two keydowns the issue captured.Base
2e0bd97e86— the H-key chord recordsmod+.(the bug):Head — the same chord records
mod+h:Head — the dedicated Period key still records
mod+.: