Summary
The checkbox hack is used in places where an interactive dropdown is needed but we don't want to require JavaScript, notably for header navigation tools in Vector and MinervaNeue. Here's an example from Vector:
The <label> element is styled to look like a button, and styles based on states like hover, focus, and active are achieved by using a selector based on the sibling <input> element's state. See these styles in the medawiki.ui button.
Currently, there is no way to effectively apply Codex button styles to a label in this way.
Implementation ideas
- As a first step, we could add selectors like the ones from mediawiki.ui linked above. This way, the CSS-only Button classes could be added to the <label> element and all necessary styles would apply, including for the different states
- In the future, we may want to consider a ButtonMenu component whose CSS-only version is the checkbox hack
Acceptance criteria
- Add the necessary selectors in the CdxButton component's styles to allow the CSS-only button styles to be used in this way
- Consider future support in Codex for this layout