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

This commit is contained in:
ValeraZSD authored and GitHub committed 2026-09-25 23:14:52 -05:00
1 parent 29a32660d3
commit 5d707bb71d
2 files changed
+15 -1

No files matched your search

+14
View File
@@ -1076,6 +1076,20 @@ describe("isRichTextBoldShortcut", () => {
assert.isTrue(isRichTextBoldShortcut(event({ key: "B", ctrlKey: true })));
});
it("matches the B key on non-Latin layouts, like the sidebar toggle does", () => {
const cyrillicB = event({ key: "и", code: "KeyB", ctrlKey: true });
assert.isTrue(isRichTextBoldShortcut(cyrillicB));
assert.strictEqual(
resolveShortcutCommand(cyrillicB, DEFAULT_BINDINGS, { platform: "Win32" }),
"sidebar.toggle",
);
});
it("follows the letter a Latin layout types, not the physical key", () => {
assert.isFalse(isRichTextBoldShortcut(event({ key: "x", code: "KeyB", ctrlKey: true })));
assert.isTrue(isRichTextBoldShortcut(event({ key: "b", code: "KeyN", ctrlKey: true })));
});
it("ignores shifted, alted, bare, and non-keydown presses", () => {
assert.isFalse(isRichTextBoldShortcut(event({ key: "b", metaKey: true, shiftKey: true })));
assert.isFalse(isRichTextBoldShortcut(event({ key: "b", metaKey: true, altKey: true })));
+1 -1
View File
@@ -425,7 +425,7 @@ export function isRichTextBoldShortcut(event: ShortcutEventLike): boolean {
return false;
}
return (
event.key.toLowerCase() === "b" &&
resolveEventKeys(event).has("b") &&
(event.metaKey || event.ctrlKey) &&
!event.altKey &&
!event.shiftKey