Skip to content
Source
Sign inSign up
pingdotgg/t3code

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

MergedValeraZSD(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/13409/headmerged by Yash-Singh1(GitHub profile, opens in a new tab) View on GitHub

Showing 2 changed files with 15 additions and 1 deletion.

x
0 of 2 viewed, 2 left
14 additions and 0 deletionsapps/web/src/keybindings.test.tsModified
View file
@@ -1076,6 +1076,20 @@
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 addition and 1 deletionapps/web/src/keybindings.tsModified
View file
@@ -425,7 +425,7 @@
return false;
return (
- event.key.toLowerCase() === "b" &&