-
Notifications
You must be signed in to change notification settings - Fork 11
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
🐛 Tooltip has wrong position if it has a parent with absolute position and moved transform #29
Comments
#30 addresses this issue and fixes a bug introduced in the last change |
It seems there is a bug, but perhaps can be addressed in a different manner. When I have a parent div |
Can you create a REPL with the issue? |
Apologies, it is quite stupid to not show the example. I wrote down something quickly:
Otherwise, I will come back to you when I have more time on my hands because I am not as handy with REPLs. This is basically the situation. I was able to omit the issue by not using relative/absolute :) |
If the tooltip is added to an element that has a parent with absolute position + moved transform, it gets positioned in the wrong place.
Reproduction: https://svelte.dev/repl/0468e8f7712f4b4fbf33a14ff1be2f0e?version=4.2.8
Reading the code (#27) that fixed the initial issue (#25), it looks like if an
offsetParent
hasabsolute
positioning, it would be easier to just position the tooltip assuming the parent's bounding client rect is the (0, 0) origin, and ignore any previousoffsetParent
s that may exist in the tree. Basically, the code shouldn't expectleft
andtop
to determine the actual positioning of the element, but should still get the correct bounding rect using.getBoundingClientRect()
.More context: I'm using Svelte Flow, and they define nodes with
position: absolute
, but move the nodes usingtransform: translate(...)
instead of settingleft
andtop
.The text was updated successfully, but these errors were encountered: