react-hotkeys v2.0.0-pre7 Release Notes

Release Date: 2019-06-02 // almost 5 years ago
  • Potentially breaking changes

    0๏ธโƒฃ react-hotkeys now ignores key combination submatches #186 by default.

    This resolves the issue of when an application has a context-dependent action, bound to a short key combination (e.g.?) and a longer global action bound to a longer key combination (e.g. shift+?), and the longer key combination is hidden behind the shorter one and never triggered whenever a child of the component that defines the shorter combination is in focus (#161, #181, #175).

    ๐Ÿ”ง If you would like the old behaviour, you can re-enable submatches with the allowCombinationSubmatches configuration option:

    configure({
      allowCombinationSubmatches: true,
    })
    

    ๐Ÿ‘€ For a full description of what this change means, and the tradeoffs, see the How combinations and sequences are matched section of the Readme.

    ๐Ÿ›  Bugfixes

    • ๐Ÿ›  Fix bug that prevented binding to keydown and key for the same key combination #166

    ๐Ÿ†• New features

    HotKeys root prop

    A new root prop is now available for HotKeys that allows placing HotKeys components at the root of the app without actually defining any key maps or handlers, to ensure all key events are recorded (#188):

    <HotKeys root>
      //... application
    </HotKeys>
    

    ๐Ÿš€ For details of when you may want to use this, see the React Hotkeys thinks I'm holding down a key I've released section of the readme.

    GlobalHotKeys report missed keyboard events

    GlobalHotKeys components now report key events that may have been missed by HotKeys, to avoid hanging key combinations when an action handler changes focus outside of the part of the React app below the highest HotKeys component.

    ๐Ÿš€ Again, you can see the React Hotkeys thinks I'm holding down a key I've released section of the readme for more details.