0

From WCAG 2.0 section 4.1:

4.1.2 Name, Role, Value: For all user interface components (including but not limited to: form elements, links and components generated by scripts), the name and role can be programmatically determined; states, properties, and values that can be set by the user can be programmatically set; and notification of changes to these items is available to user agents, including assistive technologies.

(Emphasis mine.)

Does this mean that user agents may directly add, remove or alter relevant aria-* states and value attributes, essentially altering the DOM state? If so, how would a script (e.g. a React app) maintain consistent state? Would events be fired to indicate that a change occurred?

aardrian
  • 8,581
  • 30
  • 40
eyelidlessness
  • 62,413
  • 11
  • 90
  • 94

1 Answers1

0

Does this mean that user agents may directly add, remove or alter relevant aria-* states and value attributes, essentially altering the DOM state?

No. User agents do not do this on their own.

It is up to the developer to assign these ARIA values and to maintain and adjust them as the user interacts with the page (or as the page does its own thing).

ARIA is a stop-gap (think of ARIA tabs and the proposed tabpanel — ARIA is the stopgap until/if that element gets implemented) to allow developers to make unique interface components while conveying useful information to user agents (which pass it along to screen readers).

So if you have a control that expands or collapses, it is up to you to first add the aria-expanded attribute to the control, then to add the true or false state, and then to toggle that value each time the control expands or collapses (whether by direct user action or some timed or other process).

The browser has no way of knowing that your thing is doing the thing nor that you want it to report as a thing with a state of... thing.

If so, how would a script (e.g. a React app) maintain consistent state? Would events be fired to indicate that a change occurred?

React, Angular, etc. already have methods that convey state. It is up to you as the developer to push those into the appropriate ARIA attributes where appropriate and manage them.

aardrian
  • 8,581
  • 30
  • 40