@witchcraft/spellcraft
    Preparing search index...

    Type Alias LabelOptions

    type LabelOptions = {
        labelFilter?: (
            e: AnyInputEvent | MinimalInputEvent,
            keyId: string,
            label: string,
            keys: Keys,
        ) => boolean;
        map: KeyboardLayoutMap;
    }
    Index

    Properties

    Properties

    labelFilter?: (
        e: AnyInputEvent | MinimalInputEvent,
        keyId: string,
        label: string,
        keys: Keys,
    ) => boolean

    Filters the auto labeling.

    If the filter returns true, the key is not labeled.

    You can also use this to label the key yourself.

    Common filter actions:

    • Capitalize all single character keys to match what they look like on real keyboard.
    • Prevent keys with multi-line labels (e.g. Num\nLock, Scroll\nLock from getting changed).

    Note the event is not always a real event because if it's the navigator labeling the key or you're using the Emulator class, there isn't a real event.

    See labelWithKeyboardMap. This is required for label strategies that use the navigator. You can get the map using navigator.keyboard.getLayoutMap().