primitives icon indicating copy to clipboard operation
primitives copied to clipboard

Allow indeterminate state for DropdownMenu CheckboxItem

Open colepeters opened this issue 2 years ago • 2 comments

Feature request

Overview

The Checkbox primitive allows for three states via [data-state]: checked, unchecked, and indeterminate. However, the DropdownMenu's CheckboxItem appears to only allow two states: checked and unchecked. I'd love to see parity between these two, as I have a need to create a checkbox with an indeterminate state within a dropdown.

It seems I'll need to fall back to using a Checkbox instead of a CheckboxItem in this case, though I'm not clear yet on what all the ramifications of doing so may be.

Examples in other libraries

N/A

Who does this impact? Who is this for?

This impacts any user looking for feature parity between the Checkbox and DropdownMenu.CheckboxItem primitives. :)

Additional context

That's it, pretty simple! Thanks for the consideration!

colepeters avatar Jul 28 '22 22:07 colepeters

Hi @colepeters,

I agree with you parity makes sense here and a quick search shows that the menuitemcheckbox aria role supports mixed state for "indeterminate" checkbox items.

https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/menuitemcheckbox_role

I will add this as an enhancement. If you feel like contributing, that could be an easy one to work on as there's the reference work from checkbox itself and MenuItemCheckbox is only controlled anyway, I think it should be pretty easy.

benoitgrelard avatar Aug 01 '22 22:08 benoitgrelard

Thanks @benoitgrelard! I may have some time for this over the next week or two, so I'll see if I can take a stab at it. :)

colepeters avatar Aug 02 '22 23:08 colepeters