Skip to content

Commit

Permalink
fix: improve accessibility through aria-label attribute usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Westbrook committed Oct 7, 2020
1 parent 7fce01c commit 66752b7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/bar-loader/src/BarLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,8 @@ export class BarLoader extends SpectrumElement {
} else if (this.hasAttribute('aria-valuenow')) {
this.removeAttribute('aria-valuenow');
}
if (this.label && changes.has('label')) {
this.setAttribute('aria-label', this.label);
}
}
}
6 changes: 6 additions & 0 deletions packages/circle-loader/src/CircleLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ export class CircleLoader extends SpectrumElement {
@property({ type: Boolean, reflect: true })
public indeterminate = false;

@property({ type: String })
public label = '';

@property({ type: Boolean, reflect: true, attribute: 'over-background' })
public overBackground = false;

Expand Down Expand Up @@ -86,5 +89,8 @@ export class CircleLoader extends SpectrumElement {
} else if (this.hasAttribute('aria-valuenow')) {
this.removeAttribute('aria-valuenow');
}
if (this.label && changes.has('label')) {
this.setAttribute('aria-label', this.label);
}
}
}

0 comments on commit 66752b7

Please sign in to comment.