Repository navigation
fix(shortcuts): keep Open settings off Ctrl+, on Windows/Linux, show Alt+, (#9824) - #11738
Conversation
…Alt+, (#9824) On Windows and Linux, Ctrl+, is how a Chinese or Japanese IME types a comma. Binding Open settings to Ctrl+, there swallows the keystroke before the IME sees it, so a CJK user cannot type a comma at all. The chord also fires ahead of the global enable/disable gate, so turning shortcuts off could not even work around it. Two surfaces could claim the chord, so both are fixed. The in-page binding in src/lib/shortcutRegistry.ts resolves to Alt+, off macOS. The Electron menu in website/electron/app-menu.js no longer registers CmdOrCtrl+, on those platforms: it carries accelerator "Alt+," together with registerAccelerator false, which Electron documents as a Linux/Windows option that displays a chord without registering it with the system. The caption therefore appears on File > Settings while the menu claims no key, so Ctrl+, stays free for the IME and Alt+, keeps being handled in the renderer with its focus and enable/disable gates intact. macOS is untouched and keeps a real Cmd+, binding, since a mac comma is not a Ctrl chord. Displaying the chord matters on its own: without it a habituated user whose Ctrl+, stopped working had no in-product pointer to Alt+,, and could only rediscover it through the shortcuts modal. The #9824 regression pin is rewritten rather than loosened. Asserting accelerator === undefined off macOS was a proxy for "nothing is registered", so it could not express that a caption claiming nothing is safe. It now asserts the two properties directly: the caption carries no Ctrl-class modifier in any spelling, checked by rule instead of by listing the two spellings that happened to exist, and any caption present must have registerAccelerator false. The macOS test additionally pins that registerAccelerator stays unset there, so the platform convention remains a real binding rather than a caption. Two comments claimed the desktop shell owns or reserves Ctrl+, off macOS. Nothing did, and the claim had already propagated from the module into a test comment, so both now describe the unregistered caption the code actually builds. Refs #9824
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Opus 4.8 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
First Principles Review (Fable 5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Confirm on a real Windows/Linux Electron build that the Not justified as shipped
What this change shipsInventory (7 items) — 5 justifiedIntent: stop the Settings shortcut from eating the CJK-IME comma keystroke on Windows/Linux — a FIX (linked issue #9824; the new pins fail on base).
Pin-reversal evidence (lens 8): the deleted pin "accepts Ctrl+, (the VS Code convention…)" is quoted, declared "Breaking, deliberately", and grounded in #9824/#783 — framing matches the diff. Sibling sweep: [FIRST-PRINCIPLES-REVIEWED] 98815ec |
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Verify on a real Windows/Linux Electron build that [DESIGN-REVIEWED] 98815ec |
UX Review (Fable 5) — ✅ PASSUX-level review of UX-Verdict: PASS Verify the Alt+, caption renders on the native Linux menu frame — the one surface no supplied screenshot shows (tracked in #11737). Suggestions
[UX-REVIEWED] 98815ec |
…u caption Review found the sweep this change claimed to have completed was incomplete, in exactly the way its own pattern harvest predicted: correcting a claim in one place leaves the copies behind. Four comment sites still named Ctrl+, as the Windows/Linux settings chord. - useKeyboardShortcuts.ts, isSettingsChord docblock: said the chord is Ctrl+, off macOS and that "in the desktop shell the menu accelerator fires first there". Neither holds. The chord is Alt+,, and off macOS the menu registers nothing, so no accelerator fires ahead of this handler. - useKeyboardShortcuts.ts, the open-settings dispatch: justified its position ahead of the Alt gate with "the primary chord carries no Alt". Off macOS the primary now DOES carry Alt, which makes that position load-bearing rather than incidental; the comment said the opposite, so a later reader could have moved the branch under the gate and silently killed Alt+,. No behaviour changed here - the branch already returns before the gate. - useKeyboardShortcuts.test.tsx: listed "Ctrl+, settings" among the chords the non-Mac jsdom resolves. Also pins the caption on the surface that actually renders it for Windows users. WindowsTitlebarMenu draws the application menu itself rather than calling Menu.popup(), because a native popup captures window input on Windows. So the Settings row in that component IS the caption a Windows user reads, and it is a DOM surface. Its fixture still carried CmdOrCtrl+, - a state the main process can no longer send off macOS - and nothing asserted the rendered text. The fixture now carries Alt+, and a new test asserts the row shows Alt+, and never Ctrl+,. Mutation-verified: restoring CmdOrCtrl+, to the fixture fails that test alone. That also narrows the rendered-evidence gap. Only the native menu path (Linux, macOS) is uncapturable; the Windows caption is asserted here. Tests: WindowsTitlebarMenu, useKeyboardShortcuts, shortcutRegistry and settingsShortcut suites, 204 pass. eslint and tsc clean.
5337675 to
98815ec
Compare
bolichen97
left a comment
There was a problem hiding this comment.
Reviewed the full production diff on 98815ec. Windows/Linux用Alt+,打开设置,释放输入法使用的Ctrl+,。
生产快捷键、Electron菜单及相关脚本相对共同基线在固定main上未改变。macOS保持Cmd+,;其他平台菜单只展示Alt+,而不注册系统加速键,由现有页面处理器执行。 写前逐文件对照证明本项生产文件及文档自阶段A没有变化。
Fresh REST checks: current-head PR Readiness success; no effective change request or unresolved review hold; CODEOWNERS/UX eligibility and the distinct last pusher verified. Optional baseline failures, if present, remain recorded and are not claimed green. This approval does not bypass branch protection.
…Alt+, (kirodotdev#9824) (kirodotdev#11738) * fix(shortcuts): keep Open settings off Ctrl+, on Windows/Linux, show Alt+, (kirodotdev#9824) On Windows and Linux, Ctrl+, is how a Chinese or Japanese IME types a comma. Binding Open settings to Ctrl+, there swallows the keystroke before the IME sees it, so a CJK user cannot type a comma at all. The chord also fires ahead of the global enable/disable gate, so turning shortcuts off could not even work around it. Two surfaces could claim the chord, so both are fixed. The in-page binding in src/lib/shortcutRegistry.ts resolves to Alt+, off macOS. The Electron menu in website/electron/app-menu.js no longer registers CmdOrCtrl+, on those platforms: it carries accelerator "Alt+," together with registerAccelerator false, which Electron documents as a Linux/Windows option that displays a chord without registering it with the system. The caption therefore appears on File > Settings while the menu claims no key, so Ctrl+, stays free for the IME and Alt+, keeps being handled in the renderer with its focus and enable/disable gates intact. macOS is untouched and keeps a real Cmd+, binding, since a mac comma is not a Ctrl chord. Displaying the chord matters on its own: without it a habituated user whose Ctrl+, stopped working had no in-product pointer to Alt+,, and could only rediscover it through the shortcuts modal. The kirodotdev#9824 regression pin is rewritten rather than loosened. Asserting accelerator === undefined off macOS was a proxy for "nothing is registered", so it could not express that a caption claiming nothing is safe. It now asserts the two properties directly: the caption carries no Ctrl-class modifier in any spelling, checked by rule instead of by listing the two spellings that happened to exist, and any caption present must have registerAccelerator false. The macOS test additionally pins that registerAccelerator stays unset there, so the platform convention remains a real binding rather than a caption. Two comments claimed the desktop shell owns or reserves Ctrl+, off macOS. Nothing did, and the claim had already propagated from the module into a test comment, so both now describe the unregistered caption the code actually builds. Refs kirodotdev#9824 * fix(shortcuts): finish the stale Ctrl+, sweep and pin the Windows menu caption Review found the sweep this change claimed to have completed was incomplete, in exactly the way its own pattern harvest predicted: correcting a claim in one place leaves the copies behind. Four comment sites still named Ctrl+, as the Windows/Linux settings chord. - useKeyboardShortcuts.ts, isSettingsChord docblock: said the chord is Ctrl+, off macOS and that "in the desktop shell the menu accelerator fires first there". Neither holds. The chord is Alt+,, and off macOS the menu registers nothing, so no accelerator fires ahead of this handler. - useKeyboardShortcuts.ts, the open-settings dispatch: justified its position ahead of the Alt gate with "the primary chord carries no Alt". Off macOS the primary now DOES carry Alt, which makes that position load-bearing rather than incidental; the comment said the opposite, so a later reader could have moved the branch under the gate and silently killed Alt+,. No behaviour changed here - the branch already returns before the gate. - useKeyboardShortcuts.test.tsx: listed "Ctrl+, settings" among the chords the non-Mac jsdom resolves. Also pins the caption on the surface that actually renders it for Windows users. WindowsTitlebarMenu draws the application menu itself rather than calling Menu.popup(), because a native popup captures window input on Windows. So the Settings row in that component IS the caption a Windows user reads, and it is a DOM surface. Its fixture still carried CmdOrCtrl+, - a state the main process can no longer send off macOS - and nothing asserted the rendered text. The fixture now carries Alt+, and a new test asserts the row shows Alt+, and never Ctrl+,. Mutation-verified: restoring CmdOrCtrl+, to the fixture fails that test alone. That also narrows the rendered-evidence gap. Only the native menu path (Linux, macOS) is uncapturable; the Windows caption is asserted here. Tests: WindowsTitlebarMenu, useKeyboardShortcuts, shortcutRegistry and settingsShortcut suites, 204 pass. eslint and tsc clean.
Problem / Motivation
On Windows and Linux,
Ctrl+,is how a Chinese or Japanese IME types a comma.Base
2960ec6abinds Open settings to that chord on every platform, on twosurfaces:
website/electron/app-menu.jsregistersaccelerator: "CmdOrCtrl+,"unconditionally
website/src/lib/shortcutRegistry.tsresolvesopen-settingsto{ key: ',', mod: true }for all platformsOff macOS a registered menu accelerator takes the keystroke before the IME sees
it, so a CJK user cannot type a comma at all. The chord also fires ahead of the
global shortcut enable/disable gate, so turning shortcuts off does not work
around it.
Why it matters
A Chinese or Japanese user of the desktop app loses a character in ordinary
prose, everywhere in the product, with no in-product workaround. That is not a
degraded shortcut. Users who do not type with an IME are unaffected, which is
why the defect is easy to review past.
What changed (motivation -> approach -> change)
Symptom: comma input is dead on Windows and Linux. Cause: a chord that is a
comma keystroke for an IME is registered as a global accelerator on those
platforms. Change: stop registering it, on both surfaces that could claim it.
shortcutRegistry.tsnow resolvesAlt+,off macOS and keepsCmd+,on macOS,where a comma is not a Ctrl chord.
Alt+,was already an accepted alias, so itis promoted from alias to primary rather than invented.
app-menu.jsneeded a second decision, because simply dropping the acceleratorleft the fix undiscoverable: a user whose
Ctrl+,stopped working would see amenu item with no shortcut at all and had to find
Alt+,in the shortcutsmodal. The item now carries
accelerator: "Alt+,"together withregisterAccelerator: false, which Electron documents as a Linux and Windowsoption that displays a chord without registering it with the system. So the
caption appears on
File > Settings...while the menu claims no key:Ctrl+,stays free for the IME, and
Alt+,continues to be handled in the renderer withits focus and enable/disable gates intact.
isMacis the single predicate sharedby both surfaces.
The alternative was
accelerator: "Alt+,"registered normally. Rejected: aregistered menu accelerator fires regardless of focus, which would take
Alt+,away from the in-page handler and bypass the gates that handler applies.
Displaying without registering keeps one owner for the chord.
Backwards compatibility
Breaking, deliberately:
Ctrl+,stops opening Settings on Windows andLinux. That removal is the fix.
Writer sweep on
kirocrew/main@2960ec6a: two surfaces claim this chord andboth are handled - the Electron menu (
app-menu.js, now an unregisteredAlt+,caption off macOS) and the in-page registry (
shortcutRegistry.ts, nowAlt+,as the primary off macOS).
Alt+,already resolved as an alias at this base, soa user who was already pressing
Alt+,is unaffected; a user who pressedCtrl+,is pointed at the new chord by the caption this PR adds. macOS isuntouched:
Cmd+,stays the primary andOption+,stays an alias.Tests
Measured against base
2960ec6a, whereapp-menu.test.jsassertedsettings.accelerator === "CmdOrCtrl+,"with no platform split at all.website/electron/test/app-menu.test.js- 29 pass. The#9824pin is now apair of platform-split assertions. Off macOS the caption must carry no
Ctrl-class modifier in any spelling, checked by rule rather than by listing
spellings, and any caption present must have
registerAccelerator === false.On macOS the caption must remain
CmdOrCtrl+,withregisterAcceleratorunset, so the platform convention stays a real binding rather than a caption.
Mutation-verified, each caught by exactly one assertion: dropping
registerAccelerator: false; usingCtrl+,; andControl+,, a spelling noenumeration listed.
website/src/test/WindowsTitlebarMenu.test.tsx- 24 pass, including a newassertion that the Settings row renders
Alt+,and neverCtrl+,. This is thecaption a Windows user actually reads (see Screenshots below). Its fixture
carried
CmdOrCtrl+,, a value the main process can no longer send off macOS.Mutation-verified: restoring
CmdOrCtrl+,fails that test alone.website/src/test/shortcutRegistry.test.ts,website/src/test/settingsShortcut.test.tsx,website/src/test/useKeyboardShortcuts.test.tsx- 204 pass across the touchedsuites, covering that
Ctrl+,matches nothing off macOS andAlt+,resolvesto
open-settings.eslintandtsc -p tsconfig.app.jsonclean.Comment sweep. At this base,
shortcutRegistry.tssaid "the desktop shell's menuowns Ctrl+, there" and that was true: the menu registered it. Taking the
accelerator away is what falsifies the claim, so the claim is corrected in the
same change, along with four sibling copies that carried it - the
isSettingsChorddocblock, theopen-settingsdispatch comment, the non-Macjsdom preamble in
useKeyboardShortcuts.test.tsx, and the in-page regressionpin's comment. One of those was load-bearing: the dispatch comment justified its
position ahead of the Alt gate with "the primary chord carries no Alt", which
inverts once
Alt+,is the primary, so a later reader could have moved thebranch under the gate and silently killed the chord. No behaviour changed there;
the branch already returns before the gate.
Manual verification
The menu template is built by a pure function and asserted directly, so the
accelerator string and the
registerAcceleratorflag are covered withoutlaunching the app. What no automated coverage in this repository can reach is the
native menu frame - see below.
Screenshots / video
Both changed captions are shown below. Only the native Linux and macOS menu frame
is unrenderable here, and that gap is tracked separately.
Windows
File > Settings..., the caption a Windows user reads. This is a DOMsurface, not a native frame:
WindowsTitlebarMenu.tsxdraws the submenu itselfrather than calling
Menu.popup(), because a native popup captures window inputon Windows. The row reads
Settings...withAlt+,right-aligned.Produced by
scripts/capture-settings-accelerator-caption.mjs, added in thischange. It does not hand-write the menu rows: it builds them with the real
buildMenuTemplatefromelectron/app-menu.jsand refuses to take any pictureunless that template's Settings item is exactly
Alt+,withregisterAccelerator: false. A screenshot of a string the harness chose wouldprove nothing, so the harness is not allowed to choose one.
Shortcuts modal, Windows/Linux desktop host.
Open settingsreadsAlt,and nothing else. Every other row still shows its Ctrl chord, which is what makes
this a platform-host difference rather than a global sweep: only Settings moved.
Shortcuts modal, macOS host, for the contrast the split depends on. There
Open settingsreadsCmd+,orOption+,- the platform convention staysprimary and the Option chord stays an accepted alias.
The two modal shots come from the existing
scripts/capture-shortcuts-registry.mjs, run against a build of this branch.The one remaining gap: the native menu on Linux and macOS. No harness here can
screenshot it.
website/scripts/holds roughly 200capture-*.mjsscripts andevery one drives the web app in Chromium, so none launches Electron. Building one
needs Playwright's
_electrondriver plus Xvfb, which is new test infrastructurerather than a screenshot - filed separately as #11737. The caption itself is
asserted for that path by
app-menu.test.js, so what is missing is a renderingconfirmation of the frame, not coverage of the change.
Related Issues
Refs #9824
Supersedes #10796 - same change, raised from a branch in this repository.
Rendering-evidence harness for the native menu: #11737
Pattern harvest
Rule candidate:
review-promptPattern: a regression pin asserts a proxy property (a field is absent)
instead of the property it stands for (the field is never registered with the
OS). The proxy holds while nothing else is possible, then blocks a safe
improvement and has to be restated. Worth asking of any pin whose assertion is an
absence: is absence the invariant, or is it standing in for one?
Second, demonstrated on this PR rather than theorised: when a change falsifies a
claim that a sibling module owns, the claim has usually been copied. This one
had four copies beyond the original, and an earlier revision of this description
asserted the sweep was complete while three of them were still live. Grep the
claim, not the file.
Checklist
surface now describe the built template; no user-facing doc names this chord