@react-aria/interactions 3.0.0-nightly.1288 → 3.0.0-nightly.1292

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/dist/main.js CHANGED
@@ -375,17 +375,24 @@ function usePress(props) {
375
375
  // Only handle left clicks, and ignore events that bubbled through portals.
376
376
  if (e.button !== 0 || !e.currentTarget.contains(e.target)) {
377
377
  return;
378
+ } // iOS safari fires pointer events from VoiceOver with incorrect coordinates/target.
379
+ // Ignore and let the onClick handler take care of it instead.
380
+ // https://bugs.webkit.org/show_bug.cgi?id=222627
381
+ // https://bugs.webkit.org/show_bug.cgi?id=223202
382
+
383
+
384
+ if ($ed8d760564e19d8c7d03a6a4$var$isVirtualPointerEvent(e.nativeEvent)) {
385
+ state.pointerType = 'virtual';
386
+ return;
378
387
  } // Due to browser inconsistencies, especially on mobile browsers, we prevent
379
388
  // default on pointer down and handle focusing the pressable element ourselves.
380
389
 
381
390
 
382
391
  if ($ed8d760564e19d8c7d03a6a4$var$shouldPreventDefault(e.target)) {
383
392
  e.preventDefault();
384
- } // iOS safari fires pointer events from VoiceOver (but only when outside an iframe...)
385
- // https://bugs.webkit.org/show_bug.cgi?id=222627
386
-
393
+ }
387
394
 
388
- state.pointerType = $ed8d760564e19d8c7d03a6a4$var$isVirtualPointerEvent(e.nativeEvent) ? 'virtual' : e.pointerType;
395
+ state.pointerType = e.pointerType;
389
396
  e.stopPropagation();
390
397
 
391
398
  if (!state.isPressed) {
@@ -424,7 +431,8 @@ function usePress(props) {
424
431
  };
425
432
 
426
433
  pressProps.onPointerUp = e => {
427
- if (!e.currentTarget.contains(e.target)) {
434
+ // iOS fires pointerup with zero width and height, so check the pointerType recorded during pointerdown.
435
+ if (!e.currentTarget.contains(e.target) || state.pointerType === 'virtual') {
428
436
  return;
429
437
  } // Only handle left clicks
430
438
  // Safari on iOS sometimes fires pointerup events, even
@@ -432,7 +440,7 @@ function usePress(props) {
432
440
 
433
441
 
434
442
  if (e.button === 0 && $ed8d760564e19d8c7d03a6a4$var$isOverTarget(e, e.currentTarget)) {
435
- triggerPressUp(e, state.pointerType || ($ed8d760564e19d8c7d03a6a4$var$isVirtualPointerEvent(e.nativeEvent) ? 'virtual' : e.pointerType));
443
+ triggerPressUp(e, state.pointerType || e.pointerType);
436
444
  }
437
445
  }; // Safari on iOS < 13.2 does not implement pointerenter/pointerleave events correctly.
438
446
  // Use pointer move events instead to implement our own hit testing.