Skip to content
SilktideHelp

Missing required ARIA attribute

Silktide checks elements that declare an ARIA role and verifies they also provide the attributes that role requires. Some roles are unusable without their attributes, such as a slider that never says what value it is set to.

<!-- Problem: a slider must expose its current value -->
<div role="slider" tabindex="0"></div>

<!-- Fix: provide the required state -->
<div role="slider" tabindex="0"
     aria-valuemin="0" aria-valuemax="100" aria-valuenow="50"></div>

Why this matters

Giving an element an role is a promise: "this is a slider", "this is a checkbox". Roles like these require state attributes because without them the promise is empty - a user lands on a checkbox and cannot tell whether it is checked, or on a slider and cannot tell its value or range. The control is announced, focusable, and impossible to use.

How to fix it

  1. Add the attributes the role requires, and keep them updated by script as the control's state changes - a static aria-checked="false" on a working checkbox is as misleading as none at all.
  2. Prefer native elements where they exist: <input type="checkbox"> and <input type="range"> expose their state automatically, with no ARIA to maintain.

How Silktide tests this

  1. Find every element on the page that declares a role attribute.
  2. Look up the attributes ARIA 1.2 requires for that role - for example, role="checkbox" requires aria-checked, and role="slider" requires aria-valuenow. When the role attribute lists several roles, the element's role is the first one ARIA 1.2 defines, as it is in browsers.
  3. Skip cases where the element exposes the state natively: a real checkbox or radio button already carries its checked state, a native <option> its selected state, a native <input type="range"> or <meter> its value, and a slider with aria-valuetext may omit aria-valuenow.
  4. Require aria-valuenow on a role="separator" only when it can be focused with the keyboard, as a draggable splitter between two panes can. A separator that only divides content needs no attributes.
  5. Report each element missing a required attribute. An attribute left empty, such as aria-checked="", counts as missing, because browsers ignore an empty value.

Troubleshooting

A script sets the attribute after the page loads

Silktide tests the page as it loads. If your widget only adds its state attributes on first interaction, users hear a stateless control until then - render the initial state into the page instead.

Learn more

Last updated

Was this page helpful?