@mirohq/design-system-use-press
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -82,3 +82,3 @@ 'use strict'; | ||
} | ||
if (!state.ignoreEmulatedMouseEvents && (state.pointerType === "virtual" || utils.isVirtualClick(e.nativeEvent))) { | ||
if (!state.ignoreEmulatedMouseEvents && (state.pointerType === "virtual" || isVirtualClickHandler(e))) { | ||
handleFocus({ | ||
@@ -109,3 +109,3 @@ target: e.currentTarget, | ||
state.target = e.currentTarget; | ||
state.pointerType = utils.isVirtualClick(e.nativeEvent) ? "virtual" : "mouse"; | ||
state.pointerType = isVirtualClickHandler(e) ? "virtual" : "mouse"; | ||
handleFocus({ | ||
@@ -156,2 +156,12 @@ target: e.currentTarget, | ||
}; | ||
const isVirtualClickHandler = (e) => { | ||
if ((e == null ? void 0 : e.nativeEvent) === void 0) { | ||
return false; | ||
} | ||
const nativeEvent = e.nativeEvent; | ||
if (nativeEvent.mozInputSource === void 0) { | ||
nativeEvent.mozInputSource = null; | ||
} | ||
return utils.isVirtualClick(nativeEvent); | ||
}; | ||
const shouldPreventDefault$1 = (target) => ( | ||
@@ -158,0 +168,0 @@ // We cannot prevent default if the target is a draggable element. |
@@ -78,3 +78,3 @@ import { useRef, useState, useEffect } from 'react'; | ||
} | ||
if (!state.ignoreEmulatedMouseEvents && (state.pointerType === "virtual" || isVirtualClick(e.nativeEvent))) { | ||
if (!state.ignoreEmulatedMouseEvents && (state.pointerType === "virtual" || isVirtualClickHandler(e))) { | ||
handleFocus({ | ||
@@ -105,3 +105,3 @@ target: e.currentTarget, | ||
state.target = e.currentTarget; | ||
state.pointerType = isVirtualClick(e.nativeEvent) ? "virtual" : "mouse"; | ||
state.pointerType = isVirtualClickHandler(e) ? "virtual" : "mouse"; | ||
handleFocus({ | ||
@@ -152,2 +152,12 @@ target: e.currentTarget, | ||
}; | ||
const isVirtualClickHandler = (e) => { | ||
if ((e == null ? void 0 : e.nativeEvent) === void 0) { | ||
return false; | ||
} | ||
const nativeEvent = e.nativeEvent; | ||
if (nativeEvent.mozInputSource === void 0) { | ||
nativeEvent.mozInputSource = null; | ||
} | ||
return isVirtualClick(nativeEvent); | ||
}; | ||
const shouldPreventDefault$1 = (target) => ( | ||
@@ -154,0 +164,0 @@ // We cannot prevent default if the target is a draggable element. |
{ | ||
"name": "@mirohq/design-system-use-press", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "", | ||
@@ -30,4 +30,4 @@ "author": "Miro", | ||
"@mirohq/design-system-use-listeners": "^0.1.1", | ||
"@mirohq/design-system-use-logger": "^0.1.5", | ||
"@mirohq/design-system-utils": "^0.14.3" | ||
"@mirohq/design-system-utils": "^0.14.3", | ||
"@mirohq/design-system-use-logger": "^0.1.5" | ||
}, | ||
@@ -34,0 +34,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
168978
1693