In samples of Lightning design system I have seen a lot of aria-* attributes, for example:

<ul role="tree" aria-labelledby="treeheading" ...>

<button aria-controls="accordion-details-01" aria-expanded="true" ...>

<div aria-hidden="false" ...>

Can somebody explain me what is the purpose of using those in Lightning components and what is the difference if I just skip them?


The Accessible Rich Internet Applications specification provides accessibility features for disabled individuals, as stated in the RFC:

Accessibility of web content requires semantic information about widgets, structures, and behaviors, in order to allow assistive technologies to convey appropriate information to persons with disabilities. This specification provides an ontology of roles, states, and properties that define accessible user interface elements and can be used to improve the accessibility and interoperability of web content and applications. These semantics are designed to allow an author to properly convey user interface behaviors and structural information to assistive technologies in document-level markup.

You can skip these codes if you don't care about supporting accessibility for disabled individuals, particularly if it's for your own website or Lightning components you use internally in your org. However, if you're trying to sell an app to government entities and some other orgs, your app may not be recommended or possibly even rejected if it does not meet Section 508 Requirements (in the United States), or similar requirements that may be enforced by other governments around the world.

| improve this answer | |
  • Do aria attributes change anything in user interaction? – Vladyslav K Jun 21 '17 at 14:11
  • @VladyslavKushney It only changes the behavior for users that use assistive technology (screen readers, braille screens, etc). The majority of users will not notice or be affected by aria, but for a significant minority (about 25% of Internet users), their experience will be enhanced by the aria technology. – sfdcfox Jun 21 '17 at 14:19
  • So if my users interact with application only with mouse and keyboard and use regular form controls, aria is not necessary? – Vladyslav K Jun 21 '17 at 14:23
  • 2
    @VladyslavKushney You should include them now, because if you wait until you need them, it's going to be more work. – sfdcfox Jun 21 '17 at 14:49
  • 1
    Please include them now because (at least in the United States) it is a government requirement that people of all abilities be able to use such systems, and if your company were sued, it would cost a lot of time and money. – DavidSchach Jul 20 '17 at 23:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.