Inline hints method 6: The aria-labelledby attribute with multiple values
Home | Full results | Github page
In some cases, it is not possible to wrap the label around the form control or hint. The aria-labelledby can be used to explicitly associate the hint with the form control using matching aria-labelledby and id values.
Example
Markup
<div class="form-container">
<label class="form-label" for="hint4" id="label4">Address</label>
<input class="form-input" id="hint4" type="text" aria-labelledby="label4 label1">
<span class="hint" id="label1" role="tooltip">Use your full street address</span>
</div>
Results
| OSX Voiceover | Windows NVDA | Windows JAWS | ||||||
|---|---|---|---|---|---|---|---|---|
| Chrome | Safari | Opera | Chrome | Firefox | Edge | Chrome | Firefox | Edge |
| PASS | PASS | PASS | PASS | PASS | PASS | PASS | PASS | PASS |