2 ms·
You can, but shouldn't. Visually, it can work fine but misusing the semantics of a checkbox will be confusing to screen reader users and may make it difficult t
by extra88 4y ago
You can, but shouldn't. Visually, it can work fine but misusing the semantics of a checkbox will be confusing to screen reader users and may make it difficult to operate for a voice control user.
Stick to using a button with an aria-expanded state to toggle. You can make the sibling menu contents visible based on that state.
button.menu[aria-expanded="false"] + .menu-list { display: none; }
button.menu[aria-expanded="true"] + .menu-list { display: block; }