Claude commited on
Commit
3c265ff
·
1 Parent(s): c28a145

Accessibility: drop prohibited aria-labelledby from no-role narration div

Browse files

Axe-core's wcag2aa+best-practice scan against a freshly-rendered guide
returned 0 violations but flagged the narration__body div's
aria-labelledby="narration-label-N" as an incomplete (potentially
prohibited) ARIA attribute. <div> has no implicit role, so the
attribute has no name slot to fill and many AT will ignore it
anyway — the sr-only <h3>Narration</h3> sibling already labels the
block via standard heading semantics.

Drop aria-labelledby from both guide.html and review.html. Keep the
id on the inner div so the section's <audio> element's
aria-describedby can still point at the narration text.

Re-running axe after the change: 0 violations, 0 incomplete, 43
passes. WCAG 2.2 AA clean on the rendered guide.

app/templates/guide.html CHANGED
@@ -115,15 +115,15 @@
115
  aria-describedby="narration-{{ seg.index }}"></audio>
116
  {% endif %}
117
 
118
- {# Narration paragraph(s). The visual "Narration" label is dropped;
119
- the block is obviously the narration from its position +
120
- typography. A visually-hidden header preserves the section
121
- landmark for assistive tech. #}
122
  {% if seg.narration %}
123
  <div class="narration">
124
  <h3 class="sr-only" id="narration-label-{{ seg.index }}">Narration</h3>
125
- <div class="narration__body" id="narration-{{ seg.index }}"
126
- aria-labelledby="narration-label-{{ seg.index }}">
 
 
 
 
127
  {% for para in seg.narration %}<p>{{ para|highlight_terms(seg.key_terms, glossary)|safe }}</p>{% endfor %}
128
  </div>
129
  </div>
 
115
  aria-describedby="narration-{{ seg.index }}"></audio>
116
  {% endif %}
117
 
 
 
 
 
118
  {% if seg.narration %}
119
  <div class="narration">
120
  <h3 class="sr-only" id="narration-label-{{ seg.index }}">Narration</h3>
121
+ {# Don't add aria-labelledby here: <div> has no implicit role,
122
+ so axe-core flags the attribute as prohibited. The sr-only
123
+ heading above already names the block for AT. The id stays
124
+ on the inner div so the section's <audio> element's
125
+ aria-describedby can point at it. #}
126
+ <div class="narration__body" id="narration-{{ seg.index }}">
127
  {% for para in seg.narration %}<p>{{ para|highlight_terms(seg.key_terms, glossary)|safe }}</p>{% endfor %}
128
  </div>
129
  </div>
app/templates/review.html CHANGED
@@ -339,8 +339,10 @@
339
 
340
  <div class="narration">
341
  <h3 class="sr-only" id="narration-label-{{ seg.index }}">Narration</h3>
342
- <div class="narration__body" contenteditable="true" data-bind="narration" spellcheck="true"
343
- aria-labelledby="narration-label-{{ seg.index }}">
 
 
344
  {% for para in seg.narration %}<p>{{ para }}</p>{% endfor %}
345
  </div>
346
  </div>
 
339
 
340
  <div class="narration">
341
  <h3 class="sr-only" id="narration-label-{{ seg.index }}">Narration</h3>
342
+ {# id stays on the inner div so the section's <audio>
343
+ aria-describedby can point at it; aria-labelledby would
344
+ be prohibited on a no-role <div>. #}
345
+ <div class="narration__body" contenteditable="true" data-bind="narration" spellcheck="true">
346
  {% for para in seg.narration %}<p>{{ para }}</p>{% endfor %}
347
  </div>
348
  </div>