react-tooltip 6.0.6 → 6.0.7-beta.1282.rc.0

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.
@@ -257,7 +257,8 @@
257
257
  function resolveDataTooltipAnchor(targetElement, tooltipId) {
258
258
  let currentElement = targetElement;
259
259
  while (currentElement) {
260
- if (currentElement instanceof HTMLElement && currentElement.dataset.tooltipId === tooltipId) {
260
+ const dataset = currentElement.dataset;
261
+ if ((dataset === null || dataset === void 0 ? void 0 : dataset.tooltipId) === tooltipId) {
261
262
  return currentElement;
262
263
  }
263
264
  currentElement = currentElement.parentElement;
@@ -792,7 +793,7 @@
792
793
  const addDelegatedListener = (eventType, listener, options) => {
793
794
  cleanupFns.push(addDelegatedEventListener(eventType, listener, options));
794
795
  };
795
- const activeAnchorContainsTarget = (event) => { var _a; return Boolean((event === null || event === void 0 ? void 0 : event.target) && ((_a = activeAnchorRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.target))); };
796
+ const activeAnchorContainsTarget = (event) => { var _a; return Boolean((event === null || event === void 0 ? void 0 : event.target) instanceof Node && ((_a = activeAnchorRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.target))); };
796
797
  const debouncedHandleShowTooltip = (anchor) => {
797
798
  debouncedHide.cancel();
798
799
  debouncedShow(anchor);
@@ -822,7 +823,7 @@
822
823
  }
823
824
  const relatedTarget = event.relatedTarget;
824
825
  const containerAnchor = targetAnchor || activeAnchorRef.current;
825
- if (containerAnchor === null || containerAnchor === void 0 ? void 0 : containerAnchor.contains(relatedTarget)) {
826
+ if (relatedTarget instanceof Node && (containerAnchor === null || containerAnchor === void 0 ? void 0 : containerAnchor.contains(relatedTarget))) {
826
827
  return;
827
828
  }
828
829
  debouncedHandleHideTooltip();
@@ -845,6 +846,11 @@
845
846
  debouncedHandleShowTooltip(resolveAnchorElementRef.current(event.target));
846
847
  });
847
848
  }
849
+ if (actualOpenEvents.mouseenter || actualOpenEvents.mouseover || actualOpenEvents.focus) {
850
+ addDelegatedListener('touchstart', (event) => {
851
+ debouncedHandleShowTooltip(resolveAnchorElementRef.current(event.target));
852
+ });
853
+ }
848
854
  if (actualCloseEvents.blur) {
849
855
  addDelegatedListener('focusout', (event) => {
850
856
  const targetAnchor = resolveAnchorElementRef.current(event.target);
@@ -853,7 +859,7 @@
853
859
  }
854
860
  const relatedTarget = event.relatedTarget;
855
861
  const containerAnchor = targetAnchor || activeAnchorRef.current;
856
- if (containerAnchor === null || containerAnchor === void 0 ? void 0 : containerAnchor.contains(relatedTarget)) {
862
+ if (relatedTarget instanceof Node && (containerAnchor === null || containerAnchor === void 0 ? void 0 : containerAnchor.contains(relatedTarget))) {
857
863
  return;
858
864
  }
859
865
  debouncedHandleHideTooltip();
@@ -949,6 +955,7 @@
949
955
  React.useEffect(() => {
950
956
  const handleScrollResize = () => {
951
957
  handleShowRef.current(false);
958
+ clearTimeoutRef(tooltipShowDelayTimerRef);
952
959
  };
953
960
  const tooltipScrollParent = tooltipScrollParentRef.current;
954
961
  const anchorScrollParent = anchorScrollParentRef.current;
@@ -983,7 +990,7 @@
983
990
  return;
984
991
  }
985
992
  const target = event.target;
986
- if (!(target === null || target === void 0 ? void 0 : target.isConnected)) {
993
+ if (!(target instanceof Node) || !target.isConnected) {
987
994
  return;
988
995
  }
989
996
  if ((_a = tooltipRef.current) === null || _a === void 0 ? void 0 : _a.contains(target)) {