MCPcopy
hub / github.com/github/hotkey / fireDeterminedAction

Function fireDeterminedAction

src/utils.ts:24–33  ·  view source on GitHub ↗
(el: HTMLElement, path: readonly NormalizedHotkeyString[])

Source from the content-addressed store, hash-verified

22}
23
24export 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
35export function expandHotkeyToEdges(hotkey: string): NormalizedHotkeyString[][] {
36 // NOTE: we can't just split by comma, since comma is a valid hotkey character!

Callers 1

keyDownHandlerFunction · 0.85

Calls 1

isFormFieldFunction · 0.85

Tested by

no test coverage detected