Repository navigation
Conversation
On Cyrillic, Greek, Hebrew and Arabic layouts KeyboardEvent.key is the
layout character ("л" for the K key), so normalizeAppShortcutInputKey only
fell back to event.code when Alt was held and every letter shortcut was
dead. It now uses the physical key whenever the typed character is a
non-Latin letter or digit, including punctuation positions such as [ ] and
the comma. Latin layouts (Dvorak, Colemak, AZERTY, QWERTZ) keep matching by
the typed character, the Alt path is unchanged, and shortcuts saved under a
non-Latin character still match.
matchesAppShortcutKey is the single key comparison. The composer's
paste-as-plain-text check, Prompt Library's Mod+S, the Tasks plugin's
single-key shortcuts, the desktop reload shortcut and terminal copy/paste now
use it; forkable plugins reach it through experimental_matchesShortcutKey.
Fixes #3967
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ymichael
force-pushed
the
bb/3967-keyboard-shortcuts-do-not-fire-on-non-latin-thr_tnbpyt5tu8
branch
from
November 18, 2026 21:47
e4cd184 to
181d1b3
Compare
ymichael
deleted the
bb/3967-keyboard-shortcuts-do-not-fire-on-non-latin-thr_tnbpyt5tu8
branch
November 18, 2026 21:56
3 tasks done
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.
Human comments
What was wrong
normalizeAppShortcutInputKey(packages/domain/src/app-keybindings.ts) compares the layout-dependentKeyboardEvent.keywith the binding's Latin key. It falls back to the physicalevent.codeonly when Alt is held. On a Cyrillic, Greek, Hebrew or Arabic layout the K key reportskey: "л"/"κ"/"ל"/"ن", and"л" !== "k". So Mod+K, Mod+Shift+P, Mod+, and every other letter shortcut did nothing, and so did app commands, plugin commands and embedded-browser shortcuts. Several call sites also did their ownevent.key.toLowerCase() === "v"style checks: the composer's paste-as-plain-text check, Prompt Library's Mod+S, the Tasks plugin'sc/s/p/ digit keys and the desktop Cmd+R reload. They had the same bug. Recording a shortcut on such a layout also saved"л". #3967 has the full analysis.What changed
One key comparison.
normalizeAppShortcutInputKeynow uses the physical key whenever the typed character is a single non-Latin letter or digit (\p{L}|\p{N}, not\p{Script=Latin}, not ASCII 0–9). This coversKey*,Digit*, and the punctuation positions ([ ] , . ; ' \- = \ /`), so Russian Mod+Shift+Х fires Mod+Shift+[ and Mod+Б fires Mod+,. The Alt path is unchanged, apart from also resolving those punctuation positions.ü, Turkishı) still match by the typed character.matchesAppShortcutKey(input, key)also accepts the typed character when Alt is up. Overrides a user saved under a non-Latin character ({ key: "л" }, the only workaround so far) keep working.matchesAppShortcutis built on it, so app commands, plugin commands, the desktop embedded browser, conflict detection and shortcut recording (which now recordsk) all use one rule.Every hand-rolled check routes through it:
c, rows/pand the status/priority digit menusdesktop-reload-shortcut.tsnow reads Electron'sinput.code)KeyC/KeyVfallbackModifier handling at each site is unchanged.
Plugin SDK. Composer, Prompt Library and Tasks are forkable and cannot import
@bb/domain. They call the newexperimental_matchesShortcutKey(event, key)from@get-bb/plugin-sdk/app, which is the domain function itself, both in the app runtime and in the test runtime. The PR includes:docs/api_to_audit.mdentryengines.bbPluginSdk >= 0.6.160for the three pluginsDeviation from the issue's prototype branch: it replaced the typed character outright. This PR also keeps matching the typed character (without Alt), so saved non-Latin overrides are not silently broken. It also restricts the fallback to non-Latin scripts rather than all non-ASCII characters, so
ü/é/ıon Latin layouts are untouched.No wire changes.
Credit: T3 Code fixed the same class in pingdotgg/t3code#21508 (launcher letters on non-Latin layouts) and pingdotgg/t3code#28470 (paste-as-text shortcut on non-Latin layouts), which pointed at the composer site. pingdotgg/t3code#26408 is the related layout-specific zoom fix.
How you verified
Real-browser repro (before/after). Ran
pnpm start:worktreeand sent trusted keydowns through CDPInput.dispatchKeyEventwith each layout's realkey/codepair (macOS, so Mod = Cmd):k/KeyK)л/KeyK)З/KeyP)κ/KeyK)б/Comma)k/KeyV)./KeyE)In the built app,
__bbPluginRuntime.pluginSdkApp.experimental_matchesShortcutKeyreturns true for (л/KeyK,"k") and for (М/KeyV + Shift,"v"), and false for Dvorak (k/KeyV,"v").Tests.
packages/domain/test/app-keybindings-layouts.test.ts: per-layout table covering US, Russian, Ukrainian, Greek, Hebrew, Arabic (incl. Arabic-Indic digits), Dvorak, Colemak, AZERTY, QWERTZ and Turkish. It also covers Mod+Shift+[ fromХ, saved non-Latin overrides, Windows AltGr text (Polishą, German@, Serbianђwith Ctrl+Alt) not firing Ctrl/Alt shortcuts, and macOS Option compositions. Against origin/main'sapp-keybindings.ts, 16 of these fail; the Latin and AltGr controls pass on both.Мkeeps a pasted thread URL literal (PromptBoxInternal.test.tsx).k(keyboard-shortcut-settings.test.ts).к/ρon KeyR and Dvorakr; a Latinpon KeyR does not reload.Turbo runs:
pnpm exec turbo run typecheck lint --filter=@bb/domain --filter=@bb/app --filter=@bb/desktop --filter=@get-bb/plugin-sdk --filter=bb-plugin-bb--composer --filter=bb-plugin-bb--prompt-library --filter=bb-plugin-tasks --filter=bb-plugin-plugin-api-docs: 19/19.pnpm exec turbo run teston @bb/domain, @bb/desktop, @bb/server, @bb/app, the plugin SDK, composer, prompt-library, tasks, plugin-api-docs and bb-guide: all green except two load timeouts under the parallel run, both green when rerun alone:kill-processes.test.tsCommandPalette.test.tsx(a lazy-import timeout that cascaded)Not covered: Settings still labels shortcuts with the Latin key (e.g. "Ctrl + ,") on a Cyrillic layout. Showing the active layout's characters would need
navigator.keyboard.getLayoutMap(); this is listed as an open question in the audit entry.Fixes #3967
🤖 Generated with Claude Code