W3C home > Mailing lists > Public > w3c-wai-ig@w3.org > April to June 2022

Re: Mandatory fields

From: Russ Weakley - Intopia <russ@maxdesign.com.au>
Date: Sat, 14 May 2022 11:12:56 +1000
To: "w3c-wai-ig@w3.org" <w3c-wai-ig@w3.org>
Message-Id: <95A9EC0E-C5D4-4EA8-BBB4-1702B09C4573@maxdesign.com.au>
Hi Sarah,

All mandatory form fields should be:
Programmatically identifiable
Visually identifiable


Either of the solutions below will set the field as “required" in the accessibility tree:

<input> with required
https://russmaxdesign.github.io/accessible-forms/required01.html <https://russmaxdesign.github.io/accessible-forms/required01.html>

<input> with aria-required
https://russmaxdesign.github.io/accessible-forms/required02.html <https://russmaxdesign.github.io/accessible-forms/required02.html>


There are a range of methods that visually identify mandatory fields. As Marc Haunschild mentioned, an asterisk on its own would not comply - unless there was also some sort of key above the form. Even then, this solution presents accessibility concerns. One solution is to add text saying "(Required)" to the label, so that this information is presented visually.

<input> with required and "(Required)" added to label text
https://russmaxdesign.github.io/accessible-forms/required04.html <https://russmaxdesign.github.io/accessible-forms/required04.html>

<input> with aria-required and "(Required)" added to label text
https://russmaxdesign.github.io/accessible-forms/required08.html <https://russmaxdesign.github.io/accessible-forms/required08.html>

You COULD choose to hide the visual "(Required)" text from the accessibilty tree using aria-hidden="true", but be aware this could possibly present issues for some voice command tools in some situatiosn

<input> with required and aria-hidden="true" applied to "(Required)" text
https://russmaxdesign.github.io/accessible-forms/required05.html <https://russmaxdesign.github.io/accessible-forms/required05.html>

<input> with aria-required and aria-hidden="true" applied to "(Required)" text
https://russmaxdesign.github.io/accessible-forms/required07.html <https://russmaxdesign.github.io/accessible-forms/required07.html>


> On 13 May 2022, at 11:48 pm, Ms J <ms.jflz.woop@gmail.com> wrote:
> Hello
> For 3.3.2 do mandatory fields need to be identifiable as such in the label in the first instance? Or is it sufficient to use error handling to prompt users to complete the form?
> If fields are marked with an asterisk and error handling is used to inform users when they have missed a required field, but the asterisk is not explained, does this fail 3.3.2?
> Thanks
> Sarah

Received on Monday, 16 May 2022 07:25:27 UTC

This archive was generated by hypermail 2.4.0 : Monday, 16 May 2022 07:25:28 UTC