I have a two-sided mobile menu drawer that relies on a hidden checkbox for switching/toggling between its two sides.
There are two LABEL elements, one on each side of the menu drawer. Each LABEL, via its FOR attribute, references the ID of the hidden INPUT checkbox. Clicking a displayed LABEL thus checks the INPUT checkbox and causes the menu to switch sides (via CSS). A distillation of the HTML is:
<ul class=main-menu>
<li>
<input id=toggle-drawer type=checkbox title="hidden checkbox">
<label for=toggle-drawer>See Sub Menu</label>
<ul class=sub-menu>
<li>
<label for=toggle-drawer>See Main Menu</label>
</li>
<li>Sub-menu item 1</li>
<li>Sub-menu item 2</li>
<li>Sub-menu item 3</li>
</ul>
</li>
<li>Main Menu item 1</li>
<li>Main Menu item 2</li>
<li>Main Menu item 3</li>
</ul>
It is, in fact, perfectly valid HTML to have multiple labels that reference the same input item.
See https://www.w3.org/TR/html401/interact/forms.html#h-17.9.1 :
"More than one LABEL may be associated with the same control by creating multiple references via the for attribute."
However, the WebAIM WAVE (Web Accessibility Evaluation Tool) browser extension flags the two labels as an error, stating,
"A form control should have at most one associated label element. If more than one label element is associated to the control, assistive technology may not read the appropriate label."
As a remedy, it goes on to state:
"If multiple form labels are necessary, use aria-labelledby."
aria-labelledby seems not to apply to my case, as it would be put on an INPUT item that is referenced by a DIV, etc.
Is there an ARIA or similar mark-up method I can use to satisfy this accessibility audit? I do not wish to alter my HTML structure.