For context the issue I have is that in NVDA and JAWS screenreaders, then user selects an option in a dropdown, it doesn't announce the selection. So I thought that perhaps this would solve the issue. Unfortunately, I'm unable to test it since I don't have a Windows computer.
I was wondering if changing this:
<label for="select-id" > Some Label </label>
<select id="select-id">
<option> </option</>. (empty option on purpose to have nothing selected)
<option> A </option</>
<option> B </option</>
</select>
To this, will solve my issue.
<label for="select-id" id="label-id"> Some Label </label>
<select id="select-id" aria-labelledby="label-id">
<option> </option</>. (empty option on purpose to have nothing selected)
<option> A </option</>
<option> B </option</>
</select>
Thank you!
No it will make no difference, the association is already there with the for="idOfElement"
.
As for announcing the selection then only thing that I can see from the HTML given is that you don't have a value
on the <option>
(well and the options are the same but I am assuming that is purely for the example). It shouldn't make a difference but as I have never created a <select>
without using value
attributes on the options that is the only thing I can see / think of.
For Clarity (as it isn't entirely clear what behaviour you are describing) it will not announce when you select an item, as that should already have been announced when you cycled through the options.
Expected Behaviour: