react-hotkeys
Version:
A declarative library for handling hotkeys and focus within a React application
24 lines (21 loc) • 593 B
JavaScript
/**
* Dictionary of keys that, when pressed down with the cmd key, never trigger a keyup
* event in the browser
*/
var KeysWithKeyUpHiddenByCmd = {
Enter: true,
Backspace: true,
ArrowRight: true,
ArrowLeft: true,
ArrowUp: true,
ArrowDown: true,
/**
* Caps lock is a strange case where it not only fails to trigger a keyup event when,
* pressed with cmd, but it's keyup event is triggered when caps lock is toggled off
*/
CapsLock: true
};
for (var i = 1; i < 13; i++) {
KeysWithKeyUpHiddenByCmd["F".concat(i)] = true;
}
export default KeysWithKeyUpHiddenByCmd;