-
Notifications
You must be signed in to change notification settings - Fork 6
Description
@twilco asked in another thread:
Given this markup:
<label id="label-1">
One
<label id="label-2"> Two <input type="checkbox"></label>
<label> Three <input type="checkbox"></label>
</label>When focusing the first checkbox, macOS VoiceOver reads:
- Safari: "One Two Three Two"
- Chrome: "One Two Three"
- Firefox: "Two"
This is a simplification of real markup […]
Following the letter of the spec, all labels associated with a control must be concatenated together. And if you call HTMLLabelElement.control’ on #label-1 and #label-2, they will both return the first checkbox. So by this definition, Chrome is most correct, and Safari follows the same algorithm as Chrome but duplicated part of the string. But in this case, Firefox's technically non-spec compliant behavior is the best.
If you use the for attribute, Firefox will output "One Two Three Two" (seems like a bug, like with Safari)? Seems like Firefox's behavior is that when finding labels to concatenate, it only references the nearest-ancestor label, plus the label of any number of explicit relationships with for.
Which browser seems right? If Firefox, maybe the spec needs to be clarified?