9

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?

1 Answer 1

14

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.

6
  • Do aria attributes change anything in user interaction? Commented Jun 21, 2017 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
    Commented Jun 21, 2017 at 14:19
  • So if my users interact with application only with mouse and keyboard and use regular form controls, aria is not necessary? Commented Jun 21, 2017 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
    Commented Jun 21, 2017 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. Commented Jul 20, 2017 at 23:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .