liveBook · Manning

Accessible description

As explained in Architecting Accessibility

Supplementary programmatically associated text that provides instructions, examples, or constraints for an interface control.

When a form label leaves someone unsure what to enter or where to find it, an accessible description can provide the missing instructions: a format, example, or source. section 6.1.2

...
<p>
  Required fields are marked with an asterisk (*) #A
</p>    ...
<div> 
  <label for="booking-ref">
    Booking reference * #B
  </label>
  <p id="booking-ref-hint"> #C
    Enter the 8-character code from your confirmation email (BID12345)
  </p>
  <input   
    id="booking-ref" 
    name="booking-ref" 
    type="text" 
    required #D
    aria-describedby="booking-ref-hint"> #E
</div>
...

The booking-reference hint tells users where to find the code and gives its length, format, and an example. The input references that hint with aria-describedby. section 6.1.2

Keep the description distinct from the required state: the example marks the input required separately. For clarity, put “required” next to each label rather than relying on an asterisk. section 6.1.2

How Architecting Accessibility covers it

How deep it goes
Demonstrates the association in a booking-reference form, including a hint and a separately marked required state.
Examples
Uses a booking-reference field with an eight-character confirmation-email hint and the example BID12345.
What you can do after
Build it from scratch by associating a form-control hint with its input using aria-describedby.
How it connects
Connects accessible descriptions to labels, accessible names, required fields, and the aria-describedby attribute.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Architecting Accessibility. The section links point to the parts of the book it draws on.