When should I use required vs. aria-required?
Question
Answer
If a specific user input is required for a form submission, then the element should have a required or aria-required attribute. Which one to use depends on whether or not you're using a native element.
A native element is created using an html tag, such as <button>
, whereas a non-native element would use a role
attribute, such as role="button"
, to define the element.
For example, if you have a required first name input that is coded using <input>
, use required
. However, if you're using a non-native input, add an aria-required
attribute to the element.
Free Tools to Continue Learning
Accessible Web RAMP
Monitor your website and manage your progress towards WCAG conformance.
Accessible Web Academy
Career specific courses to help power up your accessibility knowledge.