Closed RobinMalfait closed 5 months ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
headlessui-react | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Apr 19, 2024 10:59pm |
headlessui-vue | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Apr 19, 2024 10:59pm |
This PR ensures that components with the
anchor
prop always use thefloatingStyles
from Floating UI (which containsposition: absolute
).This is important, otherwise there is a brief moment where the
<ListboxOptions anchor={…} />
(in case of aListbox
) is rendered at the end of the page.One side effect of this is that this could cause a scrollbar to appear for a moment. But the
anchor
prop also renders the component in aModal
which does scroll locking (by applyingoverflow: hidden;
to the body).A side effect of adding
overflow: hidden
is that the scrollbar is removed. This is nice, but this causes a visual jump when the scrollbar is removed. To counteract this, we also add apadding-right
based on the width of the scrollbar to the body to prevent the visual jump.But because of the brief moment where the scrollbar is visible, we also add a
padding-right
to the body to prevent the visual jump actually which now causes a visual glitch now. Head scratcher...Long story short, no more accidental scrollbar appearing for a brief moment.