ShortcutSettings<E>: KeyboardShortcut & {
    action?: ((node: E, e: KeyboardEvent) => unknown);
    endAction?: ((node: E, e: KeyboardEvent) => void);
    ignoreElements?: string[];
    repeats?: boolean;
    shortcuts?: KeyboardShortcut[] | ((e: KeyboardEvent) => boolean) | KeyboardShortcut;
}

Settings for a keyboard shortcut.

Type Parameters

  • E extends Element

Type declaration

  • Optionalaction?: ((node: E, e: KeyboardEvent) => unknown)

    Callback to be triggered when shortcut is activated.

      • (node, e): unknown
      • Parameters

        • node: E
        • e: KeyboardEvent

        Returns unknown

  • OptionalendAction?: ((node: E, e: KeyboardEvent) => void)

    Callback to be triggered when key is released.

      • (node, e): void
      • Parameters

        • node: E
        • e: KeyboardEvent

        Returns void

  • OptionalignoreElements?: string[]

    Element types that prevents the shortcut from triggering.

    Defaults to ['INPUT', 'TEXTAREA'].

  • Optionalrepeats?: boolean

    Should keep triggering if key is still pressed ?

    Defaults to true.

  • Optionalshortcuts?: KeyboardShortcut[] | ((e: KeyboardEvent) => boolean) | KeyboardShortcut

    List of shortcuts that trigger the action.

    Can be a single shortcut or an array of shortcuts. If a function is provided, it should return a boolean indicating whether the shortcut is triggered based on the keyboard event.