- Success Criterion 4.1.2
- Conformance level A
Rating Widget With No Name or Value Semantics at All
4.1.2 — Name, Role, Value
Scenario
Setting
A professional networking site's profile editor
What’s wrong
Rating widgets with no name/value semantics.
Example
<div class="star-rating">
<span class="star filled" onclick="setRating(1)"></span>
<span class="star filled" onclick="setRating(2)"></span>
<span class="star filled" onclick="setRating(3)"></span>
<span class="star" onclick="setRating(4)"></span>
<span class="star" onclick="setRating(5)"></span>
</div>
<!-- five identical spans with a "filled" class toggling; no role, no name,
and no current value exposed anywhere --> Why it matters
A screen reader user endorsing a colleague's skill cannot tell how many stars are selected or set a rating at all.
How to test
Inspect a rating widget in DevTools: check for a name and value semantics (e.g., radiogroup pattern) — visual-only stars with no semantics fail.
How to fix
Model a star rating as a radio group, one radio per star value, with only one aria-checked="true" at a time.
<div class="star-rating" role="radiogroup" aria-label="Rate your endorsement confidence">
<div role="radio" aria-checked="true" tabindex="0" onclick="setRating(1)">1 star</div>
<div role="radio" aria-checked="false" tabindex="-1" onclick="setRating(2)">2 stars</div>
</div>
<!-- continues through 5 stars, each with its own aria-checked --> Outcome
A colleague sets a 3-star endorsement and hears the exact rating confirmed back.
Who is affected
Screen reader users endorsing connections cannot perceive or set the star rating for a skill.
Learn more
- Understanding Understanding document (opens in a new tab)
Related scenarios
- Custom Dropdown or Slider With No Accessibility API Support
- Content Changes That Never Update Their Accessible Name
- Scripted Link or Button With No Real Role or Keyboard Support
- Clickable Div Turned Into a Control but Given No ARIA Role
- Form Field With No Programmatic Label at All
- Assistive Technology Never Told Which Element Currently Has Focus