Update arial label for gr-change-star button

Change-Id: I99cebc33c45867ce40290be2eb4b8f41747948ca
This commit is contained in:
Tao Zhou
2020-05-28 15:44:18 +02:00
parent b865218555
commit f809f36328
2 changed files with 9 additions and 1 deletions

View File

@@ -53,6 +53,10 @@ class GrChangeStar extends GestureEventListeners(
return `gr-icons:star${starred ? '' : '-border'}`;
}
_computeAriaLabel(starred) {
return starred ? 'Unstar this change' : 'Star this change';
}
toggleStar() {
const newVal = !this.change.starred;
this.set('change.starred', newVal);

View File

@@ -37,7 +37,11 @@ export const htmlTemplate = html`
);
}
</style>
<button aria-label="Change star" on-click="toggleStar">
<button
role="checkbox"
aria-label="[[_computeAriaLabel(change.starred)]]]"
on-click="toggleStar"
>
<iron-icon
class$="[[_computeStarClass(change.starred)]]"
icon$="[[_computeStarIcon(change.starred)]]"