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