Commit a6ae3a1c authored by Malay Keshav's avatar Malay Keshav Committed by Commit Bot

Add accessibility aria labels for display zoom slider

This patch adds the required aria labels to display zoom slider.
The aria labels added are:
  - aria-valuemin
  - aria-valuemax
  - aria-valuenow
  - aria-valuetext

Bug: 791382, 790723
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: Ibb1c05d160027cefb91ca270beb5b5c54e3e669b
Component: Settings, display settings, display size slider
Reviewed-on: https://chromium-review.googlesource.com/1015778Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Commit-Queue: Malay Keshav <malaykeshav@chromium.org>
Cr-Commit-Position: refs/heads/master@{#551527}
parent 62436735
......@@ -203,7 +203,7 @@
</div>
</div>
</div>
<div class="bar-container">
<div class="bar-container" aria-hidden="true">
<paper-progress id="sliderBar" disabled$="[[disabled]]"
on-down="onBarDown_" on-up="onBarUp_" on-track="knobTrack_"
value="[[index]]" min="[[min]]" max="[[max]]">
......
......@@ -116,8 +116,12 @@ Polymer({
*/
clampAndSetIndex_: function(newIndex) {
newIndex = this.clampToRange_(newIndex, this.min, this.max);
if (newIndex != this.index)
if (newIndex != this.index) {
this._setIndex(newIndex);
this.setAttribute('aria-valuenow', this.ticks[this.index].value);
this.setAttribute(
'aria-valuetext', this.getLabelForIndex_(this.ticks, this.index));
}
},
/**
......@@ -426,6 +430,9 @@ Polymer({
for (let i = 0; i < this.ticks.length; i++)
if (this.ticks[i].value == this.pref.value)
this._setIndex(i);
this.setAttribute('aria-valuenow', this.ticks[this.index].value);
this.setAttribute(
'aria-valuetext', this.getLabelForIndex_(this.ticks, this.index));
},
/**
......@@ -466,6 +473,10 @@ Polymer({
return;
}
this.max = this.ticks.length - 1;
this.setAttribute(
'aria-valuemin', this.getLabelForIndex_(this.ticks, this.min));
this.setAttribute(
'aria-valuemax', this.getLabelForIndex_(this.ticks, this.max));
this.updateIndex_();
},
});
......
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