As part of a recent accessibility audit on Social Security Scotland’s Digital Portal, it was noted that the a field's error message should be referenced by the input.
Currently, on the examples of the Error Message component, inputs use aria-describedby to associate the input with hint text.
Error messages should also be given an id, and likewise be associated with the relevant input via the aria-describedby attribute.
E.g.:
<div class="ds_question ds_question--error" id="error-id-three">
<label class="ds_label" for="more-detail">Please provide more detail</label>
<p class="ds_hint-text" id="hint-text-more-detail">Do not include personal or financial information, like your National Insurance number or credit card details.</p>
<p class="ds_question__error-message" id="error-1-more-detail">This field is required</p>
<textarea rows="5" class="ds_input ds_input--error" id="more-detail" name="more-detail" aria-invalid="true" aria-required="true" aria-describedby="hint-text-more-detail error-1-more-detail"></textarea>
</div>
Description of the issue
As part of a recent accessibility audit on Social Security Scotland’s Digital Portal, it was noted that the a field's error message should be referenced by the input.
Currently, on the examples of the Error Message component, inputs use
aria-describedby
to associate the input with hint text.Error messages should also be given an
id
, and likewise be associated with the relevant input via thearia-describedby
attribute.E.g.: