Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-hotkeys-hook

Package Overview
Dependencies
Maintainers
1
Versions
113
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-hotkeys-hook - npm Package Compare versions

Comparing version 4.0.4 to 4.0.5

30

dist/react-hotkeys-hook.cjs.development.js

@@ -59,3 +59,12 @@ 'use strict';

right: 'arrowright',
down: 'arrowdown'
down: 'arrowdown',
'1': 'digit1',
'2': 'digit2',
'3': 'digit3',
'4': 'digit4',
'5': 'digit5',
'6': 'digit6',
'7': 'digit7',
'8': 'digit8',
'9': 'digit9'
};

@@ -296,6 +305,5 @@ function parseKeysHookInput(keys, splitKey) {

var useSafeLayoutEffect = typeof window !== 'undefined' ? react.useLayoutEffect : react.useEffect;
var pressedDownKeys = /*#__PURE__*/new Set();
function useHotkeys(keys, callback, options, dependencies) {
var ref = react.useRef(null);
var _useRef = react.useRef(new Set()),
pressedDownKeys = _useRef.current;
var _options = !(options instanceof Array) ? options : !(dependencies instanceof Array) ? dependencies : undefined;

@@ -340,2 +348,6 @@ var _deps = options instanceof Array ? options : dependencies instanceof Array ? dependencies : [];

var handleKeyDown = function handleKeyDown(event) {
if (event.key === undefined) {
// Synthetic event (e.g., Chrome autofill). Ignore.
return;
}
pressedDownKeys.add(event.key.toLowerCase());

@@ -347,2 +359,6 @@ if ((memoisedOptions == null ? void 0 : memoisedOptions.keydown) === undefined && (memoisedOptions == null ? void 0 : memoisedOptions.keyup) !== true || memoisedOptions != null && memoisedOptions.keydown) {

var handleKeyUp = function handleKeyUp(event) {
if (event.key === undefined) {
// Synthetic event (e.g., Chrome autofill). Ignore.
return;
}
if (event.key.toLowerCase() !== 'meta') {

@@ -424,5 +440,13 @@ pressedDownKeys["delete"](event.key.toLowerCase());

document.addEventListener('keydown', function (e) {
if (e.key === undefined) {
// Synthetic event (e.g., Chrome autofill). Ignore.
return;
}
pushToCurrentlyPressedKeys(e.key);
});
document.addEventListener('keyup', function (e) {
if (e.key === undefined) {
// Synthetic event (e.g., Chrome autofill). Ignore.
return;
}
removeFromCurrentlyPressedKeys(e.key);

@@ -429,0 +453,0 @@ });

2

dist/react-hotkeys-hook.cjs.production.min.js

@@ -1,2 +0,2 @@

"use strict";var e=require("react"),t=require("react/jsx-runtime");function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function o(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return r(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i=["ctrl","shift","alt","meta","mod"],u={esc:"escape",return:"enter",left:"arrowleft",up:"arrowup",right:"arrowright",down:"arrowdown"};function a(e,t){return void 0===t&&(t=","),"string"==typeof e?e.split(t):e}function c(e,t){void 0===t&&(t="+");var r=e.toLocaleLowerCase().split(t).map((function(e){return e.trim()})).map((function(e){return u[e]||e}));return n({},{alt:r.includes("alt"),ctrl:r.includes("ctrl"),shift:r.includes("shift"),meta:r.includes("meta"),mod:r.includes("mod")},{keys:r.filter((function(e){return!i.includes(e)}))})}function l(e,t){var n=e.target;void 0===t&&(t=!1);var r=n&&n.tagName;return t instanceof Array?Boolean(r&&t&&t.some((function(e){return e.toLowerCase()===r.toLowerCase()}))):Boolean(r&&t&&!0===t)}var s=e.createContext(void 0);function d(e){return t.jsx(s.Provider,{value:{addHotkey:e.addHotkey,removeHotkey:e.removeHotkey},children:e.children})}var f=e.createContext({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),y=function(){return e.useContext(f)};function v(e,t){return e&&t&&"object"==typeof e&&"object"==typeof t?Object.keys(e).length===Object.keys(t).length&&Object.keys(e).reduce((function(n,r){return n&&v(e[r],t[r])}),!0):e===t}var p=function(e){e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},m="undefined"!=typeof window?e.useLayoutEffect:e.useEffect,k=new Set;"undefined"!=typeof window&&window.addEventListener("DOMContentLoaded",(function(){document.addEventListener("keydown",(function(e){var t;t=e.key,(Array.isArray(t)?t:[t]).forEach((function(e){return k.add(c(e))}))})),document.addEventListener("keyup",(function(e){var t;t=e.key,(Array.isArray(t)?t:[t]).forEach((function(e){for(var t,n=c(e),r=o(k);!(t=r()).done;){var i,u=t.value;null!=(i=u.keys)&&i.every((function(e){var t;return null==(t=n.keys)?void 0:t.includes(e)}))&&k.delete(u)}}))}))})),exports.HotkeysProvider=function(n){var r=n.initiallyActiveScopes,o=void 0===r?["*"]:r,i=n.children,u=e.useState((null==o?void 0:o.length)>0?o:["*"]),a=u[0],c=u[1],l=e.useState([]),s=l[0],y=l[1],v=e.useMemo((function(){return a.includes("*")}),[a]),p=function(e){c(v?[e]:Array.from(new Set([].concat(a,[e]))))},m=function(e){var t=a.filter((function(t){return t!==e}));c(0===t.length?["*"]:t)};return t.jsx(f.Provider,{value:{enabledScopes:a,hotkeys:s,enableScope:p,disableScope:m,toggleScope:function(e){a.includes(e)?m(e):p(e)}},children:t.jsx(d,{addHotkey:function(e){y([].concat(s,[e]))},removeHotkey:function(e){y(s.filter((function(t){return t.keys!==e.keys})))},children:i})})},exports.isHotkeyPressed=function(e,t){return void 0===t&&(t=","),(Array.isArray(e)?e:e.split(t)).every((function(e){for(var t,n=c(e),r=o(k);!(t=r()).done;)if(v(n,t.value))return!0}))},exports.useHotkeys=function(t,n,r,o){var i=e.useRef(null),u=e.useRef(new Set).current,d=r instanceof Array?o instanceof Array?void 0:o:r,f=e.useCallback(n,[].concat(r instanceof Array?r:o instanceof Array?o:[])),k=function(t){var n=e.useRef(void 0);return v(n.current,t)||(n.current=t),n.current}(d),h=y().enabledScopes,b=e.useContext(s);return m((function(){if(!1!==(null==k?void 0:k.enabled)&&(n=null==k?void 0:k.scopes,0===(e=h).length&&n?(console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>'),1):!n||e.some((function(e){return n.includes(e)}))||e.includes("*"))){var e,n,r=function(e){var n;l(e,["input","textarea","select"])&&!l(e,null==k?void 0:k.enableOnFormTags)||(null===i.current||document.activeElement===i.current||i.current.contains(document.activeElement)?(null==(n=e.target)||!n.isContentEditable||null!=k&&k.enableOnContentEditable)&&a(t,null==k?void 0:k.splitKey).forEach((function(t){var n,r=c(t,null==k?void 0:k.combinationKey);if(function(e,t,n){var r=t.alt,o=t.ctrl,i=t.meta,u=t.mod,a=t.shift,c=t.keys,l=e.altKey,s=e.ctrlKey,d=e.metaKey,f=e.shiftKey,y=e.key,v=e.code.toLowerCase().replace("key",""),p=y.toLowerCase();if(l!==r&&"alt"!==p)return!1;if(f!==a&&"shift"!==p)return!1;if(u){if(!d&&!s)return!1}else{if(d!==i&&"meta"!==v)return!1;if(s!==o&&"ctrl"!==v)return!1}return!(!c||1!==c.length||!c.includes(p)&&!c.includes(v))||(c?c.every((function(e){return n.has(e)})):!c)}(e,r,u)||null!=(n=r.keys)&&n.includes("*")){if(function(e,t,n){("function"==typeof n&&n(e,t)||!0===n)&&e.preventDefault()}(e,r,null==k?void 0:k.preventDefault),!function(e,t,n){return"function"==typeof n?n(e,t):!0===n||void 0===n}(e,r,null==k?void 0:k.enabled))return void p(e);f(e,r)}})):p(e))},o=function(e){u.add(e.key.toLowerCase()),(void 0===(null==k?void 0:k.keydown)&&!0!==(null==k?void 0:k.keyup)||null!=k&&k.keydown)&&r(e)},s=function(e){"meta"!==e.key.toLowerCase()?u.delete(e.key.toLowerCase()):u.clear(),null!=k&&k.keyup&&r(e)};return(i.current||document).addEventListener("keyup",s),(i.current||document).addEventListener("keydown",o),b&&a(t,null==k?void 0:k.splitKey).forEach((function(e){return b.addHotkey(c(e,null==k?void 0:k.combinationKey))})),function(){(i.current||document).removeEventListener("keyup",s),(i.current||document).removeEventListener("keydown",o),b&&a(t,null==k?void 0:k.splitKey).forEach((function(e){return b.removeHotkey(c(e,null==k?void 0:k.combinationKey))}))}}}),[t,f,k,h]),i},exports.useHotkeysContext=y;
"use strict";var e=require("react"),t=require("react/jsx-runtime");function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function o(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return r(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i=["ctrl","shift","alt","meta","mod"],u={esc:"escape",return:"enter",left:"arrowleft",up:"arrowup",right:"arrowright",down:"arrowdown",1:"digit1",2:"digit2",3:"digit3",4:"digit4",5:"digit5",6:"digit6",7:"digit7",8:"digit8",9:"digit9"};function a(e,t){return void 0===t&&(t=","),"string"==typeof e?e.split(t):e}function c(e,t){void 0===t&&(t="+");var r=e.toLocaleLowerCase().split(t).map((function(e){return e.trim()})).map((function(e){return u[e]||e}));return n({},{alt:r.includes("alt"),ctrl:r.includes("ctrl"),shift:r.includes("shift"),meta:r.includes("meta"),mod:r.includes("mod")},{keys:r.filter((function(e){return!i.includes(e)}))})}function l(e,t){var n=e.target;void 0===t&&(t=!1);var r=n&&n.tagName;return t instanceof Array?Boolean(r&&t&&t.some((function(e){return e.toLowerCase()===r.toLowerCase()}))):Boolean(r&&t&&!0===t)}var d=e.createContext(void 0);function s(e){return t.jsx(d.Provider,{value:{addHotkey:e.addHotkey,removeHotkey:e.removeHotkey},children:e.children})}var f=e.createContext({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),y=function(){return e.useContext(f)};function v(e,t){return e&&t&&"object"==typeof e&&"object"==typeof t?Object.keys(e).length===Object.keys(t).length&&Object.keys(e).reduce((function(n,r){return n&&v(e[r],t[r])}),!0):e===t}var p=function(e){e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},m="undefined"!=typeof window?e.useLayoutEffect:e.useEffect,k=new Set,h=new Set;"undefined"!=typeof window&&window.addEventListener("DOMContentLoaded",(function(){document.addEventListener("keydown",(function(e){var t;void 0!==e.key&&(t=e.key,(Array.isArray(t)?t:[t]).forEach((function(e){return h.add(c(e))})))})),document.addEventListener("keyup",(function(e){var t;void 0!==e.key&&(t=e.key,(Array.isArray(t)?t:[t]).forEach((function(e){for(var t,n=c(e),r=o(h);!(t=r()).done;){var i,u=t.value;null!=(i=u.keys)&&i.every((function(e){var t;return null==(t=n.keys)?void 0:t.includes(e)}))&&h.delete(u)}})))}))})),exports.HotkeysProvider=function(n){var r=n.initiallyActiveScopes,o=void 0===r?["*"]:r,i=n.children,u=e.useState((null==o?void 0:o.length)>0?o:["*"]),a=u[0],c=u[1],l=e.useState([]),d=l[0],y=l[1],v=e.useMemo((function(){return a.includes("*")}),[a]),p=function(e){c(v?[e]:Array.from(new Set([].concat(a,[e]))))},m=function(e){var t=a.filter((function(t){return t!==e}));c(0===t.length?["*"]:t)};return t.jsx(f.Provider,{value:{enabledScopes:a,hotkeys:d,enableScope:p,disableScope:m,toggleScope:function(e){a.includes(e)?m(e):p(e)}},children:t.jsx(s,{addHotkey:function(e){y([].concat(d,[e]))},removeHotkey:function(e){y(d.filter((function(t){return t.keys!==e.keys})))},children:i})})},exports.isHotkeyPressed=function(e,t){return void 0===t&&(t=","),(Array.isArray(e)?e:e.split(t)).every((function(e){for(var t,n=c(e),r=o(h);!(t=r()).done;)if(v(n,t.value))return!0}))},exports.useHotkeys=function(t,n,r,o){var i=e.useRef(null),u=r instanceof Array?o instanceof Array?void 0:o:r,s=e.useCallback(n,[].concat(r instanceof Array?r:o instanceof Array?o:[])),f=function(t){var n=e.useRef(void 0);return v(n.current,t)||(n.current=t),n.current}(u),h=y().enabledScopes,g=e.useContext(d);return m((function(){if(!1!==(null==f?void 0:f.enabled)&&(n=null==f?void 0:f.scopes,0===(e=h).length&&n?(console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>'),1):!n||e.some((function(e){return n.includes(e)}))||e.includes("*"))){var e,n,r=function(e){var n;l(e,["input","textarea","select"])&&!l(e,null==f?void 0:f.enableOnFormTags)||(null===i.current||document.activeElement===i.current||i.current.contains(document.activeElement)?(null==(n=e.target)||!n.isContentEditable||null!=f&&f.enableOnContentEditable)&&a(t,null==f?void 0:f.splitKey).forEach((function(t){var n,r=c(t,null==f?void 0:f.combinationKey);if(function(e,t,n){var r=t.alt,o=t.ctrl,i=t.meta,u=t.mod,a=t.shift,c=t.keys,l=e.altKey,d=e.ctrlKey,s=e.metaKey,f=e.shiftKey,y=e.key,v=e.code.toLowerCase().replace("key",""),p=y.toLowerCase();if(l!==r&&"alt"!==p)return!1;if(f!==a&&"shift"!==p)return!1;if(u){if(!s&&!d)return!1}else{if(s!==i&&"meta"!==v)return!1;if(d!==o&&"ctrl"!==v)return!1}return!(!c||1!==c.length||!c.includes(p)&&!c.includes(v))||(c?c.every((function(e){return n.has(e)})):!c)}(e,r,k)||null!=(n=r.keys)&&n.includes("*")){if(function(e,t,n){("function"==typeof n&&n(e,t)||!0===n)&&e.preventDefault()}(e,r,null==f?void 0:f.preventDefault),!function(e,t,n){return"function"==typeof n?n(e,t):!0===n||void 0===n}(e,r,null==f?void 0:f.enabled))return void p(e);s(e,r)}})):p(e))},o=function(e){void 0!==e.key&&(k.add(e.key.toLowerCase()),(void 0===(null==f?void 0:f.keydown)&&!0!==(null==f?void 0:f.keyup)||null!=f&&f.keydown)&&r(e))},u=function(e){void 0!==e.key&&("meta"!==e.key.toLowerCase()?k.delete(e.key.toLowerCase()):k.clear(),null!=f&&f.keyup&&r(e))};return(i.current||document).addEventListener("keyup",u),(i.current||document).addEventListener("keydown",o),g&&a(t,null==f?void 0:f.splitKey).forEach((function(e){return g.addHotkey(c(e,null==f?void 0:f.combinationKey))})),function(){(i.current||document).removeEventListener("keyup",u),(i.current||document).removeEventListener("keydown",o),g&&a(t,null==f?void 0:f.splitKey).forEach((function(e){return g.removeHotkey(c(e,null==f?void 0:f.combinationKey))}))}}}),[t,s,f,h]),i},exports.useHotkeysContext=y;
//# sourceMappingURL=react-hotkeys-hook.cjs.production.min.js.map

@@ -57,3 +57,12 @@ import { useContext, createContext, useState, useMemo, useRef, useCallback, useLayoutEffect, useEffect } from 'react';

right: 'arrowright',
down: 'arrowdown'
down: 'arrowdown',
'1': 'digit1',
'2': 'digit2',
'3': 'digit3',
'4': 'digit4',
'5': 'digit5',
'6': 'digit6',
'7': 'digit7',
'8': 'digit8',
'9': 'digit9'
};

@@ -294,6 +303,5 @@ function parseKeysHookInput(keys, splitKey) {

var useSafeLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
var pressedDownKeys = /*#__PURE__*/new Set();
function useHotkeys(keys, callback, options, dependencies) {
var ref = useRef(null);
var _useRef = useRef(new Set()),
pressedDownKeys = _useRef.current;
var _options = !(options instanceof Array) ? options : !(dependencies instanceof Array) ? dependencies : undefined;

@@ -338,2 +346,6 @@ var _deps = options instanceof Array ? options : dependencies instanceof Array ? dependencies : [];

var handleKeyDown = function handleKeyDown(event) {
if (event.key === undefined) {
// Synthetic event (e.g., Chrome autofill). Ignore.
return;
}
pressedDownKeys.add(event.key.toLowerCase());

@@ -345,2 +357,6 @@ if ((memoisedOptions == null ? void 0 : memoisedOptions.keydown) === undefined && (memoisedOptions == null ? void 0 : memoisedOptions.keyup) !== true || memoisedOptions != null && memoisedOptions.keydown) {

var handleKeyUp = function handleKeyUp(event) {
if (event.key === undefined) {
// Synthetic event (e.g., Chrome autofill). Ignore.
return;
}
if (event.key.toLowerCase() !== 'meta') {

@@ -422,5 +438,13 @@ pressedDownKeys["delete"](event.key.toLowerCase());

document.addEventListener('keydown', function (e) {
if (e.key === undefined) {
// Synthetic event (e.g., Chrome autofill). Ignore.
return;
}
pushToCurrentlyPressedKeys(e.key);
});
document.addEventListener('keyup', function (e) {
if (e.key === undefined) {
// Synthetic event (e.g., Chrome autofill). Ignore.
return;
}
removeFromCurrentlyPressedKeys(e.key);

@@ -427,0 +451,0 @@ });

{
"name": "react-hotkeys-hook",
"version": "4.0.4",
"version": "4.0.5",
"repository": "https://JohannesKlauss@github.com/JohannesKlauss/react-keymap-hook.git",

@@ -46,3 +46,3 @@ "homepage": "https://johannesklauss.github.io/react-hotkeys-hook/",

"devDependencies": {
"@babel/core": "7.20.2",
"@babel/core": "7.20.5",
"@babel/plugin-proposal-class-properties": "7.18.6",

@@ -57,9 +57,9 @@ "@babel/plugin-transform-react-jsx": "7.19.0",

"@testing-library/user-event": "14.4.3",
"@types/jest": "29.2.2",
"@types/react": "18.0.15",
"@types/react-dom": "18.0.6",
"@types/jest": "29.2.4",
"@types/react": "18.0.26",
"@types/react-dom": "18.0.9",
"eslint-plugin-prettier": "4.2.1",
"jest": "29.2.2",
"jest-environment-jsdom": "29.2.2",
"prettier": "2.7.1",
"jest": "29.3.1",
"jest-environment-jsdom": "29.3.1",
"prettier": "2.8.1",
"react": "18.2.0",

@@ -70,3 +70,3 @@ "react-dom": "18.2.0",

"tslib": "2.4.0",
"typescript": "4.7.4"
"typescript": "4.9.4"
},

@@ -73,0 +73,0 @@ "peerDependencies": {

@@ -45,2 +45,7 @@ import { Hotkey } from './types'

document.addEventListener('keydown', e => {
if (e.key === undefined) {
// Synthetic event (e.g., Chrome autofill). Ignore.
return
}
pushToCurrentlyPressedKeys(e.key)

@@ -50,2 +55,7 @@ })

document.addEventListener('keyup', e => {
if (e.key === undefined) {
// Synthetic event (e.g., Chrome autofill). Ignore.
return
}
removeFromCurrentlyPressedKeys(e.key)

@@ -52,0 +62,0 @@ })

@@ -12,2 +12,11 @@ import { Hotkey, KeyboardModifiers, Keys } from './types'

down: 'arrowdown',
'1': 'digit1',
'2': 'digit2',
'3': 'digit3',
'4': 'digit4',
'5': 'digit5',
'6': 'digit6',
'7': 'digit7',
'8': 'digit8',
'9': 'digit9',
}

@@ -14,0 +23,0 @@

@@ -24,2 +24,4 @@ import { HotkeyCallback, Keys, Options, OptionsOrDependencyArray, RefType } from './types'

const pressedDownKeys = new Set<string>()
export default function useHotkeys<T extends HTMLElement>(

@@ -32,3 +34,2 @@ keys: Keys,

const ref = useRef<RefType<T>>(null)
const { current: pressedDownKeys } = useRef<Set<string>>(new Set())

@@ -56,3 +57,2 @@ const _options: Options | undefined = !(options instanceof Array) ? (options as Options) : !(dependencies instanceof Array) ? (dependencies as Options) : undefined

// REF IS THE ACTIVE ELEMENT. THIS IS A PROBLEM SINCE FOCUSED SUB COMPONENTS WONT TRIGGER THE HOTKEY.
if (ref.current !== null && document.activeElement !== ref.current && !ref.current.contains(document.activeElement)) {

@@ -86,2 +86,7 @@ stopPropagation(e)

const handleKeyDown = (event: KeyboardEvent) => {
if (event.key === undefined) {
// Synthetic event (e.g., Chrome autofill). Ignore.
return
}
pressedDownKeys.add(event.key.toLowerCase())

@@ -95,2 +100,7 @@

const handleKeyUp = (event: KeyboardEvent) => {
if (event.key === undefined) {
// Synthetic event (e.g., Chrome autofill). Ignore.
return
}
if (event.key.toLowerCase() !== 'meta') {

@@ -97,0 +107,0 @@ pressedDownKeys.delete(event.key.toLowerCase())

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc