react-hotkeys-hook
Advanced tools
Comparing version 4.4.2 to 4.4.3
{ | ||
"name": "react-hotkeys-hook", | ||
"description": "React hook for handling keyboard shortcuts", | ||
"version": "4.4.2", | ||
"version": "4.4.3", | ||
"repository": { | ||
@@ -81,14 +81,14 @@ "type": "git", | ||
"devDependencies": { | ||
"@babel/core": "7.23.2", | ||
"@babel/core": "7.23.7", | ||
"@babel/plugin-proposal-class-properties": "7.18.6", | ||
"@babel/plugin-transform-react-jsx": "7.22.15", | ||
"@babel/preset-env": "7.23.2", | ||
"@babel/preset-react": "7.22.15", | ||
"@babel/preset-typescript": "7.23.2", | ||
"@babel/plugin-transform-react-jsx": "7.23.4", | ||
"@babel/preset-env": "7.23.7", | ||
"@babel/preset-react": "7.23.3", | ||
"@babel/preset-typescript": "7.23.3", | ||
"@testing-library/jest-dom": "5.17.0", | ||
"@testing-library/react": "14.0.0", | ||
"@testing-library/user-event": "14.4.3", | ||
"@types/jest": "29.5.6", | ||
"@types/react": "18.2.33", | ||
"@types/react-dom": "18.2.14", | ||
"@testing-library/react": "14.1.2", | ||
"@testing-library/user-event": "14.5.2", | ||
"@types/jest": "29.5.11", | ||
"@types/react": "18.2.46", | ||
"@types/react-dom": "18.2.18", | ||
"@typescript-eslint/eslint-plugin": "5.60.0", | ||
@@ -106,4 +106,4 @@ "@typescript-eslint/parser": "5.60.0", | ||
"tsdx": "0.14.1", | ||
"tslib": "2.5.3", | ||
"typescript": "5.0.4" | ||
"tslib": "2.6.2", | ||
"typescript": "5.3.3" | ||
}, | ||
@@ -110,0 +110,0 @@ "peerDependencies": { |
@@ -67,16 +67,14 @@ import { HotkeyCallback, Keys, Options, OptionsOrDependencyArray, RefType } from './types' | ||
if (memoisedOptions?.ignoreEventWhen?.(e)) { | ||
return | ||
} | ||
// TODO: SINCE THE EVENT IS NOW ATTACHED TO THE REF, THE ACTIVE ELEMENT CAN NEVER BE INSIDE THE REF. THE HOTKEY ONLY TRIGGERS IF THE | ||
// REF IS THE ACTIVE ELEMENT. THIS IS A PROBLEM SINCE FOCUSED SUB COMPONENTS WON'T TRIGGER THE HOTKEY. | ||
if ( | ||
ref.current !== null && | ||
document.activeElement !== ref.current && | ||
!ref.current.contains(document.activeElement) | ||
) { | ||
stopPropagation(e) | ||
return | ||
if (ref.current !== null) { | ||
const rootNode = ref.current.getRootNode() | ||
if ( | ||
(rootNode instanceof Document || rootNode instanceof ShadowRoot) && | ||
rootNode.activeElement !== ref.current && | ||
!ref.current.contains(rootNode.activeElement) | ||
) { | ||
stopPropagation(e) | ||
return | ||
} | ||
} | ||
@@ -92,2 +90,6 @@ | ||
if (isHotkeyMatchingKeyboardEvent(e, hotkey, memoisedOptions?.ignoreModifiers) || hotkey.keys?.includes('*')) { | ||
if (memoisedOptions?.ignoreEventWhen?.(e)) { | ||
return | ||
} | ||
if (isKeyUp && hasTriggeredRef.current) { | ||
@@ -94,0 +96,0 @@ return |
@@ -62,3 +62,3 @@ import { FormTags, Hotkey, Scopes, Trigger } from './types' | ||
if (!keys?.includes(keyCode) && !['ctrl', 'control', 'unknown', 'meta', 'alt', 'shift', 'os'].includes(keyCode)) { | ||
return false; | ||
return false | ||
} | ||
@@ -65,0 +65,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
195058
33
1703
0
1
1