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