Problem/Motivation
Drupal core makes widespread use of invisible labels, aimed at screen reader users. Unfortunately these techniques can cause problems for speech control users, if used incorrectly. WCAG 2.1 introduces new success criterion 2.5.3: Label in Name to address these problems.
This issue is about auditing Drupal core for "Label in Name", and correcting any problems found.
Background reading:
- Understanding Success Criterion 2.5.3: Label in Name
- Improving web navigation for speech recognition users
- Exploring WCAG 2.1 — 2.5.3 Label in Name
- Make screenreader say button alt-attribute instead of innerText - A worked example of pass/failure markup techniques in a StackOverflow answer.
- Label and name from content mismatch - some examples of pass/fail involving
aria-label
Proposed resolution
- Survey ALL instances of .visually-hidden, aria-label, aria-labelledby.
- This is potentially a BIG survey, so we may split this plan up by module, theme, etc.
- For any problems found, file a child issue to correct them.
Example:
- PASS:
t("Manage fields <span class="visually-hidden">for @bundle</span>", ["@bundle" => $entity->bundle()]). A speech control user can activate this by saying "Click manage fields" and their assistive tech can narrow the choices down to the instances which match. So users can choose from a handful of relevant matches. - FAIL:
t("Manage <span class="visually-hidden">@bundle</span> fields", ["@bundle" => $entity->bundle()]). A speech control user cannot activate this by saying the visible link text. "Click manage fields" won't work, because that exact phrase doesn't appear in the names given to assistive tech. The user will have to say "Show numbers" to highlight all controls on the page, instead of just a few relevant matches.
TODO: Make a set of instructions for testing this. Flesh out the pass/fail examples to include scenarios with aria-label and aria-labelledby. A good starting point would be this answer the situations described in this Stack Overflow answer: Make screenreader say button alt-attribute instead of innerText
Remaining tasks
User interface changes
Update strings where any violations occur.
API changes
None.
Data model changes
None.
Comments
Comment #2
andrewmacpherson commentedI wonder if we can crowd-share this work, say as an activity in the Global Sprint Weekend.
Comment #3
mgiffordThat looks like it is 25-27.01.2019 - that right?
Would this be a big Google Spreadsheet we'd be building on? Not sure how to do this type of system wide review.
Comment #4
andrewmacpherson commentedThere's a multilingual UI translation aspect of this. A review of all core code will only confirm that the default English UI strings satisfy WCAG Label in Name.
However UI translators could cause a WCAG failure here. Most of our dynamic translatable strings work by putting variables inside. I understand this is so translators have flexibility over things like word order, idiom, choosing which parts of a sentence should be linked, and the freedom to choose appropriate visually-hidden text. But when translating a string which contains a visually-hidden span, a translator could cause a "Label in name" problem if they put visually-hidden text between two visible words.
Example:
t("Manage fields <span class="visually-hidden">for @bundle</span>", ["@bundle" => $entity->bundle()])t("Manage <span class="visually-hidden">@bundle</span> fields", ["@bundle" => $entity->bundle()])How can we address this?
Added a pass/fail example to the issue summary.
Comment #5
andrewmacpherson commentedI'll let the interface translation maintainer (Gabor) know about this.
Comment #6
andrewmacpherson commented#3 - @mgifford - Epic spreadsheet FTW! I don't relish the idea, but I can't suggest anything better :-)
Comment #8
andrewmacpherson commentedComment #17
mgiffordI think this is more of a search for issues, rather than "there are issues"
Comment #18
prabuela commentedComment #19
prabuela commentedThe best is as discussed earlier, split the module or theme sub issue, will help to fix the issue.
Comment #20
prabuela commented