-
-
Notifications
You must be signed in to change notification settings - Fork 206
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
[Link Preview] Lost Anchor After Remounting Trigger #1060
Closed
anatolzak opened this issue
Mar 5, 2024
· 0 comments
· Fixed by #1053 or #1126 · May be fixed by dev-komenzar/melt-ui#1 or patooworld/novel#3
Closed
[Link Preview] Lost Anchor After Remounting Trigger #1060
anatolzak opened this issue
Mar 5, 2024
· 0 comments
· Fixed by #1053 or #1126 · May be fixed by dev-komenzar/melt-ui#1 or patooworld/novel#3
Labels
bug
Something isn't working
Comments
This was referenced Mar 26, 2024
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
If you unmount the link preview trigger without unmounting
createLinkPreview()
, and then remount the trigger, when you try to open the content, the content shows up at the top left of the pageScreen.Recording.2024-03-05.at.1.40.20.PM.mov
The reason for this is that we only set the
activeTrigger
oncreateLinkPreview
mount, butactiveTrigger
should be set when the trigger mounts in the trigger action, which would rerun every time a new trigger is mounted, making sure we always have a reference to the up-to-date trigger.And the reason the content shows up at the top left of the page, is because activeTrigger is still holding a reference to an html element that was unmounted. But even though it was unmounted, it's still technically a valid element but with a client rect of
{ top: 0, left: 0, width: 0, height: 0 }
hence why the content is showing up at the top left of the page.This is solved in the following PR #1053
Reproduction
https://github.com/anatolzak/melt-ui-link-preview-unmount-bug/blob/main/src/routes/+page.svelte
https://melt-ui-link-preview-unmount-bug.vercel.app/
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: