everweij / react-laag

Hooks to build things like tooltips, dropdown menu's and popovers in React
https://www.react-laag.com
MIT License
907 stars 47 forks source link

[FEATURE] add possibility to interact with elements in tooltip when using "UseHover" hook #77

Closed Gussarah closed 2 years ago

Gussarah commented 2 years ago

Is your feature request related to a problem? Please describe. Using useHover hook, I'm trying to add a link or button into tooltip. But when I'm interacting with the link or button, tooltip just closes on mobile devices

Describe the solution you'd like It would be great, if tooltip don't close, while interacting with it, when trigger type is hover on mobile devices

Thanks.

everweij commented 2 years ago

Does this help? https://github.com/everweij/react-laag/issues/65#issuecomment-889761355

btravel commented 2 years ago

Have the same issue. Suggested solution from #65 doesn't work cause there is an embedded in effect 'touchEnd' event handler that works on capture phase. Seems there is no way to override it from outside:

function onTouchEnd() {
  if (show) {
    removeTimeout();
    setShow(false);
  }
}

window.addEventListener("touchend", onTouchEnd, true);