tailwindlabs / headlessui

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

Make sure data-disabled is available on virtualized options #3128

Closed thecrypticace closed 5 months ago

thecrypticace commented 5 months ago

When using a combobox disabled options get a data-disabled attribute that can be used for styling. However, when the combobox was virtualized we were not. This happened because we were only looking at the disabled prop on the option itself but a virtual combobox uses a disabled function in the virtual options to determine whether or not an option is enabled.

This fixes that 👍

@RobinMalfait you have an idea on how this should be tested?

vercel[bot] commented 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 24, 2024 1:29pm
headlessui-vue ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 24, 2024 1:29pm
RobinMalfait commented 5 months ago

@thecrypticace if I'm not mistaken we run all tests for the Combobox against a virtual and non-virtual version. So if you add a test where you explicitly test that data-disabled is present then that should cover this. Undoing your change should then result in a failing test.

thecrypticace commented 5 months ago

We run all the "interaction" tests but not rendering tests. But this is simple enough to add a test for — will do!

thecrypticace commented 5 months ago

Test added