WebAIM - Web Accessibility In Mind

E-mail List Archives

ARIA best practise with inserting aria attributes based upon a condition or being pre-populated.

for

From: Murphy, Sean
Date: Nov 20, 2020 5:50PM


Team,

I have done some searching on the net and haven't found anything on this topic. I want to find out what is the best practise and if there is any technical documentation to support the approach which I have outlined below.


1. If you have an element. Depending on a codition of what the user has done on the web site. Some aria attributes are added to the tag via javascript. For example: An edit field contains the aria-required attribute. The aria-invalid is added to the <input> field after the field fails the validation javascript. This edit field does not have any required by design.
2. A aria-hidden="true" is added to an <div> depending if the content has been expanded or not. Rather than just using <div aria-hidden="false"> then changing the parameter.


These are just two examples to illustrate what I am referring too. Thus I wish to know if the correct behaviour should be:

<input .... Aria-invalid="false" aria-required=true"> over <input .... Aria-required="true"> then adding the extra attributes.

Any supporting documentation to support peoples views would be helpful.

Regards
Sean Murphy

Sean Murphy | Senior Digital System specialist (Accessibility)
Telstra Digital Channels | Digital Systems
Mobile: 0405 129 739 | Desk: (02) 9866-7917
Digital Systems Launch Page<https://confluence.in.telstra.com.au/display/DCSYS/Digital+Systems+-+Able+Home>
Accessibility Single source of Truth<https://confluence.in.telstra.com.au/display/DCSYS/Accessibility+Resources>