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.4.2 to 4.4.3

dist/BoundHotkeysProxyProvider.d.ts

26

package.json
{
"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 @@

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