-
Notifications
You must be signed in to change notification settings - Fork 3.4k
checkbox: links in text are not rendered in a way that makes JAWS happy #11134
Comments
Likely as a side effect of this, the text in the link is voiced twice by the screen reader. When there is no link, the content of the checkbox is "ignored" in the accessibility tree. |
I enhanced the CodePen a bit for me to test with. This included adding a I will try to do some more testing using VoiceOver and Safari. |
The issue does not manifest itself in ChromeVox (neither in your example nor in mine), but it does occur in JAWS (at least on Firefox on Windows). |
We currently parse everything inside of the My research into more a11y-friendly/normal implementations would use: However moving to the label/native input method would be a breaking change. We're going to try to solve this by testing without the |
Understood. I agree with the "normal implementation" you described, but understand that it would be a breaking change. Your proposed alternative sounds good to me, thanks! |
I am able to reproduce this on macOS and Safari with Voiceover. When navigating by links, the privacy policy link within the checkbox is skipped. The extra <md-checkbox ng-model="data.cb1" tabindex="0" type="checkbox" role="checkbox"
class="ng-pristine ng-untouched ng-valid ng-not-empty md-checked"
aria-label="I agree to the privacy policy." aria-checked="true"
aria-invalid="false">
<div class="md-container md-ink-ripple" md-ink-ripple="" md-ink-ripple-checkbox="">
<div class="md-icon"></div>
</div>
<div ng-transclude="" class="md-label">
I agree to the <a href="https://www.google.com/"
ng-click="$event.stopPropagation()" class="ng-scope"> privacy policy</a>.
</div>
</md-checkbox> Setting I tried a number of approaches with different combinations of For the time being, the second example in my CodePen appears to be the best approach to doing this in an accesible way with As far as I've been able to determine, supporting accessible links within It's also something that Angular Material (v2+) has already done. |
Would a workaround with <div class="my-checkbox-label" id="agree-label">
I agree to the <a href="...">Terms of service</a>
</div>
<md-checkbox aria-labelledby="agree-label"></md-checkbox> |
The following has the same visual layout and behavior while also working properly in Voiceover: <md-checkbox ng-model="data.cb1" aria-labelledby="agree-label"></md-checkbox>
<span id="agree-label" onclick="data.cb1 = !data.cb1">
I agree to the <a href="https://www.google.com/">privacy policy</a>.
</span> To make this part of the directive, we need to solve some problems
|
don't toggle the checkbox on link actions don't output aria warnings when using aria-labelledby require md-input-container when using links in checkbox labels update license copyright year Fixes #11134
I have the first draft of a PR up for this. To use a link in a checkbox label you would need to do the following: <md-input-container>
<md-checkbox ng-model="data.cb5">
I agree to the <a href="/license">license</a>.
</md-checkbox>
</md-input-container> If you want to omit the |
don't toggle the checkbox on link actions don't output aria warnings when using aria-labelledby require md-input-container when using links in checkbox labels update license copyright year Fixes #11134
don't toggle the checkbox on link actions don't output aria warnings when using aria-labelledby require md-input-container when using links in checkbox labels update license copyright year Fixes #11134
don't toggle the checkbox on link actions don't output aria warnings when using aria-labelledby require md-input-container when using links in checkbox labels update license copyright year Fixes #11134
As this change is a breaking change, I've pushed it to 1.2.0. More details in #11154 (comment). |
- JAWS and Voiceover should properly handle links in md-checkbox labels - Wrapping the checkbox in a `md-input-container` is required - for using links in checkbox labels due to layout considerations - Add new demos for different types of a11y checkbox labels - don't toggle the checkbox on link actions - don't output aria warnings when using `aria-labelledby` - require `md-input-container` when using links in checkbox labels Fixes #11134.
- JAWS and Voiceover should properly handle links in md-checkbox labels - Wrapping the checkbox in a `md-input-container` is required - for using links in checkbox labels due to layout considerations - Add new demos for different types of a11y checkbox labels - don't toggle the checkbox on link actions - don't output aria warnings when using `aria-labelledby` - require `md-input-container` when using links in checkbox labels Fixes #11134. BREAKING CHANGE: If you've created a custom solution to style links within `md-checkbox` labels, then you may need to remove or change that code now. This is because we automatically detect `<a>` tags in these labels and re-render them in an accessible way.
- JAWS and Voiceover should properly handle links in md-checkbox labels - Wrapping the checkbox in a `md-input-container` is required - for using links in checkbox labels due to layout considerations - Add new demos for different types of a11y checkbox labels - don't toggle the checkbox on link actions - don't output aria warnings when using `aria-labelledby` - require `md-input-container` when using links in checkbox labels Fixes #11134. BREAKING CHANGE: If you've created a custom solution to style links within `md-checkbox` labels, then you may need to remove or change that code now. This is because we automatically detect `<a>` tags in these labels and re-render them in an accessible way.
Bug, feature request, or proposal:
Bug
What is the expected behavior?
A link (
<a href="...">
) nested inside an<md-checkbox ...>
element should be recognized as a link by screen readers such as JAWS. This entails being accessible via screen reader specific navigation shortcuts (U and V keys for JAWS), and upon receiving focus it should be announced that the focused element is a link.What is the current behavior?
Such links are not accessible via shortcut keys, and are not announced as links.
CodePen and steps to reproduce the issue:
CodePen Demo] which shows your issue:
https://codepen.io/anon/pen/VQdGBX
Detailed Reproduction Steps:
<a>
inside a<md-checkbox>
(such as the CodePen example linked above)What is the use-case or motivation for changing an existing behavior?
A11y - Currently, a standard practice (placing links inside a checkbox label) results in an inaccessible page.
Which versions of AngularJS, Material, OS, and browsers are affected?
Angular 1.6
Material 1.1
Windows 10 Enterprize
Firefox 52.6.0 ESR
JAWS 2018 (1712 10 ILM), NVDA 2017.4
Is there anything else we should know? Stack Traces, Screenshots, etc.
The HTML output by Angular results in the following accessibility tree:
I suspect a link typically should be inside a label, not nested directly within the checkbox.
The text was updated successfully, but these errors were encountered: