Skip to content

Commit 066c216

Browse files
Add test
1 parent ea382d3 commit 066c216

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

packages/core/src/components/hotkeys/hotkeyParser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ function maybeGetKeyFromEventCode(e: KeyboardEvent) {
192192
/**
193193
* Determines the key combo object from the given keyboard event. A key combo includes zero or more modifiers
194194
* (represented by a bitmask) and one key. We prefer using the `key` property to respect the user's keyboard layout,
195-
* but fall back to `code` for Alt-modified characters to avoid issues with Alt producing special characters on macOS.
195+
* but fall back to `code` for Alt-modified characters to avoid issues with Alt producing special characters.
196196
*
197197
* @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key
198198
*/

packages/docs-app/src/examples/core-examples/hotkeysTargetExample.tsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,30 @@ export class HotkeysTargetExample extends PureComponent<ExampleProps, HotkeysTar
6060
label: "Focus the piano",
6161
onKeyDown: this.focusPiano,
6262
},
63+
{
64+
combo: "ctrl + B",
65+
group: "Modifier Tests",
66+
label: "Test Ctrl+B",
67+
onKeyDown: () => console.log("Ctrl+B pressed"),
68+
},
69+
{
70+
combo: "alt + B",
71+
group: "Modifier Tests",
72+
label: "Test Alt+B",
73+
onKeyDown: () => console.log("Alt+B pressed"),
74+
},
75+
{
76+
combo: "shift + B",
77+
group: "Modifier Tests",
78+
label: "Test Shift+B",
79+
onKeyDown: () => console.log("Shift+B pressed"),
80+
},
81+
{
82+
combo: "meta + B",
83+
group: "Modifier Tests",
84+
label: "Test Cmd/Meta+B",
85+
onKeyDown: () => console.log("Meta+B pressed"),
86+
},
6387
{
6488
combo: "Q",
6589
group: "HotkeysTarget Example",

0 commit comments

Comments
 (0)