authorgravatar for 48602572+ValeraZSD@users.noreply.github.comValeraZSD <48602572+ValeraZSD@users.noreply.github.com> 2026-09-26 06:14:52+02:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-25 23:14:52-05:00
log5d707bb71de19eb0eb6fe4688602ee853aec2e3c
treeaf96b073b9fc8355b131dc1985d12340bf66dd48
parent29a32660d3cb2ade1f13283f889b519f73b24fbd
signature Signed by PGP key B5690EEEBB952194

fix(web): Mod+B bolds on non-Latin layouts (#13409)


2 files changed, 15 insertions(+), 1 deletions(-)

apps/web/src/keybindings.test.ts+14
...@@ -1076,6 +1076,20 @@ describe("isRichTextBoldShortcut", () => {...@@ -1076,6 +1076,20 @@ describe("isRichTextBoldShortcut", () => {
1076 assert.isTrue(isRichTextBoldShortcut(event({ key: "B", ctrlKey: true })));1076 assert.isTrue(isRichTextBoldShortcut(event({ key: "B", ctrlKey: true })));
1077 });1077 });
10781078
1079 it("matches the B key on non-Latin layouts, like the sidebar toggle does", () => {
1080 const cyrillicB = event({ key: "и", code: "KeyB", ctrlKey: true });
1081 assert.isTrue(isRichTextBoldShortcut(cyrillicB));
1082 assert.strictEqual(
1083 resolveShortcutCommand(cyrillicB, DEFAULT_BINDINGS, { platform: "Win32" }),
1084 "sidebar.toggle",
1085 );
1086 });
1087
1088 it("follows the letter a Latin layout types, not the physical key", () => {
1089 assert.isFalse(isRichTextBoldShortcut(event({ key: "x", code: "KeyB", ctrlKey: true })));
1090 assert.isTrue(isRichTextBoldShortcut(event({ key: "b", code: "KeyN", ctrlKey: true })));
1091 });
1092
1079 it("ignores shifted, alted, bare, and non-keydown presses", () => {1093 it("ignores shifted, alted, bare, and non-keydown presses", () => {
1080 assert.isFalse(isRichTextBoldShortcut(event({ key: "b", metaKey: true, shiftKey: true })));1094 assert.isFalse(isRichTextBoldShortcut(event({ key: "b", metaKey: true, shiftKey: true })));
1081 assert.isFalse(isRichTextBoldShortcut(event({ key: "b", metaKey: true, altKey: true })));1095 assert.isFalse(isRichTextBoldShortcut(event({ key: "b", metaKey: true, altKey: true })));
apps/web/src/keybindings.ts+1-1
...@@ -425,7 +425,7 @@ export function isRichTextBoldShortcut(event: ShortcutEventLike): boolean {...@@ -425,7 +425,7 @@ export function isRichTextBoldShortcut(event: ShortcutEventLike): boolean {
425 return false;425 return false;
426 }426 }
427 return (427 return (
428 event.key.toLowerCase() === "b" &&428 resolveEventKeys(event).has("b") &&
429 (event.metaKey || event.ctrlKey) &&429 (event.metaKey || event.ctrlKey) &&
430 !event.altKey &&430 !event.altKey &&
431 !event.shiftKey431 !event.shiftKey