• 
      

    Add a registry model and view for managing keyboard shortcuts.

    Review Request #13591 — Created Feb. 29, 2024 and submitted

    Information

    Ink
    master

    Reviewers

    Part of Ink's focus on accessibility is formalizing support for keyboard
    shortcuts. Components will be able to easily list keyboard shortcuts
    that trigger an element, providing both a visual indicator and ARIA
    information for screen readers.

    Keyboard shortcuts will be registered in the new
    KeyboardShortcutRegistry model, which takes a key, modifier flags, and
    a callback handler, and registers it for quick access.

    A corresponding KeyboardShortcutRegistryView can be attached to an
    existing element and a registry model to invoke the handlers when those
    keys are pressed.

    Once attached, a registry view can be found on any ancestor DOM element
    by using KeyboardShortcutRegistryView.findNearestRegistryView.
    Similarly, a nearest registry can be found using
    findNearestRegistry().. This makes it easy for components to
    automatically register with the correct registry.

    The plan is to eventually let the view pop up a dialog when ? is
    pressed, to show the available keyboard shortcuts. This has been a
    long-standing plan for Review Board, and with these new foundational
    classes, we'll be able to offer this.

    Unit tests pass.

    Summary ID
    Add a registry model and view for managing keyboard shortcuts.
    Part of Ink's focus on accessibility is formalizing support for keyboard shortcuts. Components will be able to easily list keyboard shortcuts that trigger an element, providing both a visual indicator and ARIA information for screen readers. Keyboard shortcuts will be registered in the new `KeyboardShortcutRegistry` model, which takes a key, modifier flags, and a callback handler, and registers it for quick access. A corresponding `KeyboardShortcutRegistryView` can be attached to an existing element and a registry model to invoke the handlers when those keys are pressed. Once attached, a registry view can be found on any ancestor DOM element by using `KeyboardShortcutRegistryView.findNearestRegistryView`. Similarly, a nearest registry can be found using `findNearestRegistry().`. This makes it easy for components to automatically register with the correct registry. The plan is to eventually let the view pop up a dialog when `?` is pressed, to show the available keyboard shortcuts. This has been a long-standing plan for Review Board, and with these new foundational classes, we'll be able to offer this.
    16876d6e49792e51376bd3cae1018b96bb70789d
    Description From Last Updated

    Typo: "mappin" -> "mapping".

    maubinmaubin
    maubin
    1. 
        
    2. Show all issues

      Typo: "mappin" -> "mapping".

    3. 
        
    david
    1. Once the typo that Michelle mentioned is fixed, I'm happy.

    2. 
        
    chipx86
    chipx86
    david
    1. Ship It!
    2. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to master (9e41ad5)