tailwindlabs / headlessui

Completely unstyled, fully accessible UI components, designed to integrate beautifully with Tailwind CSS.
https://headlessui.com
MIT License
25.02k stars 1.03k forks source link

Fix initial `anchor="selection"` state #3324

Closed RobinMalfait closed 1 week ago

RobinMalfait commented 1 week ago

This PR fixes a bug where using the anchor="selection" results in an incorrectly positioned anchor panel.

This happened because we computed the index too late and didn't re-render to fix up the UI.

To solve this, this PR computes it based on actual state instead of DOM nodes.

We will also compute the selected option based on the frozen state. This will prevent UI glitches while closing the Listbox.

vercel[bot] commented 1 week 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 Jun 25, 2024 9:53am
headlessui-vue ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 25, 2024 9:53am