Wagtail client-side components
    Preparing search index...

    Adds the ability to trigger a button click event using a keyboard shortcut declared on the controlled element.

    <button type="button" data-controller="w-kbd" aria-keyshortcuts="alt+p">Trigger me with alt+p.</button>
    
    <button type="button" data-controller="w-kbd" data-w-kbd-key="[">Trigger me with the <kbd>[</kbd> key.</button>
    
    <button type="button" data-controller="w-kbd" data-w-kbd-key="mod+s">Trigger me with <kbd>ctrl+p</kbd> on Windows or <kbd>cmd+p</kbd> on MacOS.</button>
    
    <button type="button" data-controller="w-kbd" data-w-kbd-key="mod+s" data-w-kbd-scope-value="global">Trigger me globally.</button>
    
    - use aria-keyshortcuts (when the key string is compatible with Mousetrap's syntax)
    

    Hierarchy

    Index

    Constructors

    • Parameters

      • context: Context

      Returns KeyboardController

    Properties

    context: Context
    keyValue: string

    Keyboard shortcut string.

    scopeValue: "" | "global"

    Scope of the keyboard shortcut, defaults to the normal MouseTrap (non-input) scope.

    blessings: (<T>(constructor: Constructor<T>) => any)[]
    outlets: string[]
    targets: string[]
    values: {
        key: { default: string; type: StringConstructor };
        scope: { default: string; type: StringConstructor };
    } = ...

    Accessors

    • get application(): Application

      Returns Application

    • get classes(): ClassMap

      Returns ClassMap

    • get data(): DataMap

      Returns DataMap

    • get element(): ElementType

      Returns ElementType

    • get identifier(): string

      Returns string

    • get outlets(): OutletSet

      Returns OutletSet

    • get scope(): Scope

      Returns Scope

    • get targets(): TargetSet

      Returns TargetSet

    • get shouldLoad(): boolean

      Returns boolean

    Methods

    • Returns void

    • Returns void

    • Parameters

      • eventName: string
      • Optional__namedParameters: Partial<
            {
                bubbles: boolean;
                cancelable: boolean;
                detail: Object;
                prefix: string;
                target: Element
                | Window
                | Document;
            },
        >

      Returns CustomEvent<Object>

    • When a key is set or changed, bind the handler to the keyboard shortcut. This will override the shortcut, if already set.

      Parameters

      • key: string
      • previousKey: string

      Returns void

    • Parameters

      • _identifier: string
      • _application: Application

      Returns void