UNPKG

873 BJavaScriptView Raw
1var _a;
2import { KeyCodes } from './KeyCodes';
3var DirectionalKeyCodes = (_a = {},
4 _a[KeyCodes.up] = 1,
5 _a[KeyCodes.down] = 1,
6 _a[KeyCodes.left] = 1,
7 _a[KeyCodes.right] = 1,
8 _a[KeyCodes.home] = 1,
9 _a[KeyCodes.end] = 1,
10 _a[KeyCodes.tab] = 1,
11 _a[KeyCodes.pageUp] = 1,
12 _a[KeyCodes.pageDown] = 1,
13 _a);
14/**
15 * Returns true if the keycode is a directional keyboard key.
16 */
17export function isDirectionalKeyCode(which) {
18 return !!DirectionalKeyCodes[which];
19}
20/**
21 * Adds a keycode to the list of keys that, when pressed, should cause the focus outlines to be visible.
22 * This can be used to add global shortcut keys that directionally move from section to section within
23 * an app or between focus trap zones.
24 */
25export function addDirectionalKeyCode(which) {
26 DirectionalKeyCodes[which] = 1;
27}
28//# sourceMappingURL=keyboard.js.map
\No newline at end of file