I am fairly new to accessibility issues and I am trying to have the aria-label read in NVDA.
This is my HTML:
<div class="myClass">
<input type="checkbox" name="mycheckbox" id="toggle" onclick="togglelongText()"aria-label="tldr">
<label for="toggle" aria-label="tldr"><span class="active" aria-label="tldr">tl;dr</span>
<span class="toggleshape"></span><span class="inactive" aria-hidden="true">tl;dr</span></label>
</div>
The label cannot be read on NVDA on Windows and I have found out that it is not consistently succesful if the element is inside div or span:
https://www.w3.org/WAI/GL/wiki/Using_aria-label_to_provide_an_invisible_label
What are the alternatives? Can you help?
Thanks,
Regards,
P.
EDIT:
I have done some re-work and I managed to have the aria label only partially working as it now reads "tl;dr". This has been tested on Windows 7 with Chrome 54, IE 11 and Firefox 49, all presenting the same issue. Here the reworked code:
<div class="myClass">
<input type="checkbox" tabindex="0" name="mycheckbox" id="toggle" onclick="toggleLongText()"
aria-label="TL;DR switch">
<label for="toggle" aria-label="TL;DR switch"><span class="active" tabindex="0"
aria-label="TL;DR switch">tl;dr</span><span class="toggleshape"></span>
<span class="inactive">tl;dr</span></label>
</div>
Can you help?