Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): respect keyboard layouts for command shortcuts #5021

Closedmapringg(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/5021/headopened View on GitHub

Showing 2 changed files with 50 additions and 2 deletions.

x
0 of 2 viewed, 2 left
47 additions and 0 deletionsapps/web/src/keybindings.test.tsModified
View file
@@ -656,6 +656,53 @@
});
​
+ it("uses layout-aware letters for Command shortcuts", () => {
+ const keybindings = compile([
+ { shortcut: modShortcut("k"), command: "commandPalette.toggle" },
+ { shortcut: modShortcut("p"), command: "filePicker.toggle" },
+ {
+ shortcut: modShortcut("f", { shiftKey: true }),
+ command: "projectSearch.toggle",
+ },
+ { shortcut: modShortcut("n"), command: "chat.new" },
+ ]);
+ const cases = [
+ {
+ label: "Colemak Command K",
+ event: event({ key: "k", code: "KeyN", metaKey: true }),
+ expected: "commandPalette.toggle",
+ },
+ {
+ label: "Colemak Command E",
+ event: event({ key: "e", code: "KeyK", metaKey: true }),
+ expected: null,
+ },
+ {
+ label: "Colemak Command P",
+ event: event({ key: "p", code: "KeyR", metaKey: true }),
+ expected: "filePicker.toggle",
+ },