Consider the following:
<label for="fav-pizza">Favourite Pizza (required)</label>
<input type="text" id="fav-pizza" required="required" />
<p>For example, Pepperoni, Meat feast, or Hawaiian</p>
I know it's best practice for the help text to be programmatically-associated with the input via the use of aria-describedby
however I'm trying to find out if it's a WCAG 2.1 requirement. Would this be a failure point if it isn't programmatically-associated.
The same question goes for inline error text, for example the following is displayed after the user submitted the form and the page reloaded:
<label for="first-name">First name (required)</label>
<input type="text" id="first-name" required="required" />
<p class="error">Error: enter your first name.</p>
Is it a WCAG 2.1 (AA) failure if the error text is not programmatically-associated with the input?
I've read through the following and I'm struggling to get a clear answer: 1.3.1 Info & Relationships (Level A) 3.3.1 Error Identification (Level A) 3.3.2 Labels or Instructions (Level A) 3.3.3 Error Suggestion (Level AA)
It's worth noting that 3.3.2 Labels or Instructions (Level A) gives a sufficient technique of G131 Providing descriptive labels coupled with ARIA1 using the aria-describedby property to provide a descriptive label for user interface controls. Also Deque's accessibility checklist states that "Programmatic Association of Input Instructions: Instructions for an element MUST be programmatically-associated with the element." required under 3.3.2 - though I can't find anything to suggest that is correct.