MAIDR JavaScript API
    Preparing search index...

    Service for registering and managing keyboard bindings across application scopes.

    Observes the settings so a shortcut the reader changes in the help menu takes effect at once: the bindings are torn down and put back with the new overrides, in the scope the reader is in, without the page reloading.

    hotkeys-js keeps one handler table and one active scope for the page, and every chart on it binds the same scope names there. So each service keeps the handlers it bound and takes back only those, and the owner -- the service of the chart the reader entered last -- is the only one whose handlers act and the only one that moves the scope. Leaving, disposing or rebinding one chart then never takes another chart's keys or scope with it.

    Implements

    Index

    Constructors

    Methods

    • Re-binds this chart's keys when the reader's shortcuts change.

      Nothing moves for a settings change that leaves the shortcuts alone -- volume, language, a braille display -- because unbinding and rebinding is not free and the reader may be mid-chord.

      Parameters

      • settings: Settings

        The settings just saved

      Returns void

    • Activates a keyboard scope, so only that scope's bindings fire.

      Context decides which scope the reader is in and fires onScopeChange; this applies it. Only this class writes the hotkeys-js scope, and of the services on the page only the owner does -- or any of them while nobody owns the keyboard. A chart the reader has left still keeps its own scope, for a rebind to put back, but no longer moves the one the reader is in.

      Parameters

      • scope: Scope

        The scope to activate

      Returns void

    • Whether the reader's keymap, in the scope they are in, binds the key a keydown carries -- the defaults, or a shortcut the reader chose instead.

      For a host-page guard deciding whether a key it would keep from the page is one MAIDR needs: stopping it before the document hides it from the bindings here as well.

      Parameters

      • event: KeyboardEvent

        The keydown

      Returns boolean

      True when a binding of the current scope would claim the key

    • Unregisters this chart's keyboard bindings, and no other chart's.

      Returns void