(el: HTMLElement, path: readonly NormalizedHotkeyString[])
| 22 | } |
| 23 | |
| 24 | export function fireDeterminedAction(el: HTMLElement, path: readonly NormalizedHotkeyString[]): void { |
| 25 | const delegateEvent = new CustomEvent('hotkey-fire', {cancelable: true, detail: {path}}) |
| 26 | const cancelled = !el.dispatchEvent(delegateEvent) |
| 27 | if (cancelled) return |
| 28 | if (isFormField(el)) { |
| 29 | el.focus() |
| 30 | } else { |
| 31 | el.click() |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | export function expandHotkeyToEdges(hotkey: string): NormalizedHotkeyString[][] { |
| 36 | // NOTE: we can't just split by comma, since comma is a valid hotkey character! |
no test coverage detected