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

Update the aria labels only if the index is updated

This patch ensures that the aria labels are updated only when the index
is updated on the display size slider. Without this we may update the
aria label with an index in the array that is out of bounds. This
happens in certain race conditions where the index has been updated but
the array has not or vice versa.

Bug: 854809
Cq-Include-Trybots: luci.chromium.try:closure_compilation
Change-Id: I23807fe8b0a27ead8323b7a3d484db14ce79bf7d
Component: Display Size slider, display settings
Reviewed-on: https://chromium-review.googlesource.com/1108933
Commit-Queue: Malay Keshav <malaykeshav@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#569334}
parent b2ce0204
......@@ -436,12 +436,14 @@ Polymer({
return;
if (!this.pref)
return;
for (let i = 0; i < this.ticks.length; i++)
if (this.ticks[i].value == this.pref.value)
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));
}
}
},
/**
......
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