Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Links inside tooltip #60

Closed
elias-fadeyev opened this issue Apr 11, 2019 · 10 comments
Closed

Links inside tooltip #60

elias-fadeyev opened this issue Apr 11, 2019 · 10 comments

Comments

@elias-fadeyev
Copy link

Reproduction demo

https://codesandbox.io/s/1q9yy1342j

Steps to reproduce the problem

  1. Click on the trigger
  2. Click on the link

What is the expected behavior?

I think click trigger should allow events inside the tooltip

What went wrong?

The link doesn't follow the URL.
Click on the link triggers _this.handleOutsideClick() and then it calls event.preventDefault().

Any other comments?

Do we have any possibility to avoid this?
Or wouldn't it be a good idea to add outsideClickHandler to props?

Packages versions

  • react-popper-tooltip: 2.8.1
@mohsinulhaq
Copy link
Owner

mohsinulhaq commented Apr 11, 2019

Please try out v2.8.2 which has a potential fix.

@elias-fadeyev
Copy link
Author

Now it works, thank you!
As a related issue, is it possible to change click listener to mousedown for outsideClickHandler? We use this tooltip inside a drag'n'drop container and, if we move the container, outsideClickHandler doesn't trigger and, as a result, the tooltip stays shown outside of the container.

@mohsinulhaq
Copy link
Owner

Does it close when you drop the container?

@elias-fadeyev
Copy link
Author

No, in our case click is not triggered after dropping and it stays opened, only mouseup is fired.

@mohsinulhaq
Copy link
Owner

mohsinulhaq commented Apr 12, 2019

I attach a click handler to document to handle outside click, whenever the tooltip opens. Do you know how is that not triggered? Is your mouseup or mousedown handler stopping propagation to the click handler? Basically, what I mean is that the outside click mechanism should just work irrespective of what drag action you are doing because click event is always triggered.

@elias-fadeyev
Copy link
Author

Yep, we are using react-sortablejs and it seems that it stops propagation inside mouseup handler, if an order of elements has been changed. That's why we don't have click event now, but I think it's not a big deal. I mean isn't it a strange behavior of a tooltip to stay at the same place, when the container is moved to an opposite side of the window, even if it will be hidden after that?

@denisborovikov
Copy link
Collaborator

@elias-fadeyev Did you try to play with usePortal/portalContainer props? Tooltip can be attached to the draggable element instead of the document body. In this case, it should move with the appropriate container.

@elias-fadeyev
Copy link
Author

@denisborovikov. Agree, but then this tooltip will be restricted to have the body only inside the container. It won't work for a big tooltip.

@denisborovikov
Copy link
Collaborator

denisborovikov commented Apr 12, 2019

@elias-fadeyev Does outer container have overflow: hidden? You can try to apply overflow on the inner part of the draggable element so the mutual wrapper won't cut the tooltip.

@elias-fadeyev
Copy link
Author

@denisborovikov my fault, you are absolutely right! Unfortunately, a big tooltip now works as a handle and I can use it to drag'n'drop the container, as a part of it) I'll try to find the solution for preventing this behavior. Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants