@react-aria/interactions 3.8.1 → 3.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-aria/interactions",
3
- "version": "3.8.1",
3
+ "version": "3.8.2",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -18,8 +18,8 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@babel/runtime": "^7.6.2",
21
- "@react-aria/utils": "^3.11.2",
22
- "@react-types/shared": "^3.11.1"
21
+ "@react-aria/utils": "^3.11.3",
22
+ "@react-types/shared": "^3.11.2"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "react": "^16.8.0 || ^17.0.0-rc.1"
@@ -27,5 +27,5 @@
27
27
  "publishConfig": {
28
28
  "access": "public"
29
29
  },
30
- "gitHead": "404d41859b7d6f56201d7fc01bd9f22ae3512937"
30
+ "gitHead": "ed8d8d984c2f7f2c31e8b18795b97858a95e4729"
31
31
  }
package/src/usePress.ts CHANGED
@@ -321,7 +321,7 @@ export function usePress(props: PressHookProps): PressResult {
321
321
 
322
322
  // Due to browser inconsistencies, especially on mobile browsers, we prevent
323
323
  // default on pointer down and handle focusing the pressable element ourselves.
324
- if (shouldPreventDefault(e.target as Element)) {
324
+ if (shouldPreventDefault(e.currentTarget as HTMLElement)) {
325
325
  e.preventDefault();
326
326
  }
327
327
 
@@ -359,7 +359,7 @@ export function usePress(props: PressHookProps): PressResult {
359
359
  // Chrome and Firefox on touch Windows devices require mouse down events
360
360
  // to be canceled in addition to pointer events, or an extra asynchronous
361
361
  // focus event will be fired.
362
- if (shouldPreventDefault(e.target as Element)) {
362
+ if (shouldPreventDefault(e.currentTarget as HTMLElement)) {
363
363
  e.preventDefault();
364
364
  }
365
365
 
@@ -443,7 +443,7 @@ export function usePress(props: PressHookProps): PressResult {
443
443
 
444
444
  // Due to browser inconsistencies, especially on mobile browsers, we prevent
445
445
  // default on mouse down and handle focusing the pressable element ourselves.
446
- if (shouldPreventDefault(e.target as Element)) {
446
+ if (shouldPreventDefault(e.currentTarget as HTMLElement)) {
447
447
  e.preventDefault();
448
448
  }
449
449
 
@@ -764,9 +764,9 @@ function isOverTarget(point: EventPoint, target: HTMLElement) {
764
764
  return areRectanglesOverlapping(rect, pointRect);
765
765
  }
766
766
 
767
- function shouldPreventDefault(target: Element) {
768
- // We cannot prevent default if the target is inside a draggable element.
769
- return !target.closest('[draggable="true"]');
767
+ function shouldPreventDefault(target: HTMLElement) {
768
+ // We cannot prevent default if the target is a draggable element.
769
+ return !target.draggable;
770
770
  }
771
771
 
772
772
  function shouldPreventDefaultKeyboard(target: Element) {