element-hq / compound

Element's design system
https://compound.element.io
Apache License 2.0
12 stars 3 forks source link

Toggle menu item has no correct way to use it #319

Closed robintown closed 3 months ago

robintown commented 5 months ago

Platform

Package version

Description

As of https://github.com/element-hq/compound-web/pull/178, the toggle menu item appears impossible to use correctly. Imagine that the toggle is controlled by const [checked, setChecked] = useState(false):

robintown commented 5 months ago

Looking at what Radix does for their pre-packaged toggle menu item: they avoid putting any actual \<label> or \<input> elements inside the menu item, and just rely on the ARIA attributes of the parent element. That's probably the simplest solution here.