Closed knpwrs closed 2 years ago
This appears to work:
6c6
< const [floatingRef, floatingContent] = createFloatingActions({
---
> const [floatingRef, floatingContent, updatePosition] = createFloatingActions({
14a15,18
>
> $: if (open) {
> updatePosition();
> }
I wonder if there's a way to support this use case more automatically?
Hi! Apparently this is due to the work of Portal, possibly due to the fact that it renders content outside of the parent component
There is an updatePosition for such situations, it is perfect for non-standard cases
Thank you for reporting this, I hope it helps the others ✨
When attempting to use
svelte-floating-ui
withsvelte-portal
the floating element initially renders in the wrong position. Resizing the window or closing and opening the floating UI fixes it (at least, closing and opening controlled bydisplay: none/block;
). If I were to make an educated guess I would say that the floating ui calcualtions are being done before the floating element is moved to the portal.Here is some example code: