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

followCursor tooltip - reposition if you mouse over tooltip #89

Closed
penx opened this issue Mar 16, 2020 · 8 comments
Closed

followCursor tooltip - reposition if you mouse over tooltip #89

penx opened this issue Mar 16, 2020 · 8 comments

Comments

@penx
Copy link

penx commented Mar 16, 2020

Describe the bug
In followCursor mode, the tooltip doesn't reposition if you move the mouse over the tooltip

To Reproduce
Steps to reproduce the behavior:

  1. Go to the follow cursor demo https://react-popper-tooltip.netlify.com/#follow-cursor
  2. Mouse over to see tooltip
  3. Quickly move the mouse over the tooltip
  4. Tooltip doesn't reposition

Expected behavior
react-popper-tooltip should ensure tooltip doesn't sit underneath cursor when in followCursor mode.

Screenshots

follow-cursor

Desktop (please complete the following information):

  • OS: Mac OS X
  • Browser: Chrome
  • Version: 83.0.4086.0
@mohsinulhaq
Copy link
Owner

this is the intended behaviour, as it's tracking mouse position within the bounds of the trigger and not the tooltip or anything else

@penx
Copy link
Author

penx commented Mar 16, 2020

This is "within the bounds of the trigger" but the tooltip is overlayed on top of these bounds. If the tooltip was repositioned instantly then you would never see this issue as you wouldn't be able to mouse over it. The issue happens when you quickly move the mouse over the tooltip before it has a chance to reposition.

I accept this may be hard to solve due to the inner workings of what's happening, but I'd question whether this is intended behaviour.

@penx
Copy link
Author

penx commented Mar 16, 2020

followCursor

@mohsinulhaq
Copy link
Owner

oh got it, yes the positioning happens asynchronously, so your situation can occur. Right now I don't have the bandwidth to look into it. Feel free to raise a PR. Otherwise I'll give it a look this weekend.

@denisborovikov
Copy link
Collaborator

I believe, if you add pointer-events: none to the .tooltip-container it should resolve this issue.

@penx
Copy link
Author

penx commented Mar 16, 2020

Yep that works for me, thanks! Happy for this issue to be closed, unless you think it needs to be solved in the lib or added to the docs.

@penx
Copy link
Author

penx commented Mar 16, 2020

on second thoughts, if it's easy enough to add pointer-events: none, but only when followCursor is true, then probably a good idea to do this in react-popper-tooltip so others don't get unexpected jankiness

@mohsinulhaq
Copy link
Owner

@penx the library doesn't and shouldn't come with inherent CSS, just event handlers, CSS is kept to the user to add. Hence I'm closing the issue.

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