Commit a23518d2 authored by James Vecore's avatar James Vecore Committed by Commit Bot

[SmartLock] a11y: Make radio buttons a single group for reader

The screen reader was reading each radio button three times.
Once for the polymer element and once for each inner div. To
Fix the issue I moved the aria attributes out the polymer
element and gave the inner divs the role of presentation so
they are not re-read.

Bug: 1007054
Change-Id: I9f4e8e2954a097c78bc1668e40b27fbff5759055
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1881480Reviewed-by: default avatarRyan Hansberry <hansberry@chromium.org>
Commit-Queue: James Vecore <vecore@google.com>
Cr-Commit-Position: refs/heads/master@{#710509}
parent 2309cfe9
...@@ -31,19 +31,16 @@ ...@@ -31,19 +31,16 @@
</style> </style>
<div <div
aria-checked$="[[getAriaChecked_(checked)]]" role="presentation"
aria-disabled$="[[getAriaDisabled_(disabled)]]"
aria-labelledby="labelWrapper"
class="disc-wrapper" class="disc-wrapper"
id="button" id="button"
role="radio"
tabindex="0" tabindex="0"
on-keydown="onInputKeydown_"> on-keydown="onInputKeydown_">
<div class="disc-border"></div> <div class="disc-border"></div>
<div class="disc"></div> <div class="disc"></div>
</div> </div>
<div id="labelWrapper"> <div id="labelWrapper" role="presentation">
<span>[[label]]</span> <span>[[label]]</span>
</div> </div>
......
...@@ -9,6 +9,34 @@ Polymer({ ...@@ -9,6 +9,34 @@ Polymer({
CrRadioButtonBehavior, CrRadioButtonBehavior,
], ],
hostAttributes: {'role': 'radio'},
properties: {
ariaChecked: {
type: String,
notify: true,
reflectToAttribute: true,
computed: 'getAriaChecked_(checked)'
},
ariaDisabled: {
type: String,
notify: true,
reflectToAttribute: true,
computed: 'getAriaDisabled_(disabled)'
},
ariaLabel: {
type: String,
notify: true,
reflectToAttribute: true,
computed: 'getLabel_(label)'
}
},
getLabel_: function(label) {
return label;
},
/** /**
* Prevents on-click handles on the control from being activated when the * Prevents on-click handles on the control from being activated when the
* indicator is clicked. * indicator is clicked.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment