Skip to content

Commit

Permalink
fix(action-group): allow direct setting aria-label on first update
Browse files Browse the repository at this point in the history
  • Loading branch information
Westbrook committed May 17, 2021
1 parent 0aae8ed commit 84f7fdd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion packages/action-group/src/ActionGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,11 @@ export class ActionGroup extends SpectrumElement {
) {
this.manageChildren();
}
if (changes.has('label')) {
// Update `aria-label` when `label` available or not first `updated`
if (
changes.has('label') &&
(this.label || typeof changes.get('label') !== 'undefined')
) {
if (this.label.length) {
this.setAttribute('aria-label', this.label);
} else {
Expand Down
2 changes: 1 addition & 1 deletion packages/action-group/test/action-group.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe('ActionGroup', () => {
it('loads default action-group accessibly', async () => {
const el = await fixture<ActionGroup>(
html`
<sp-action-group label="Default Group">
<sp-action-group aria-label="Default Group">
<sp-action-button>First</sp-action-button>
<sp-action-button>Second</sp-action-button>
<sp-action-button>Third</sp-action-button>
Expand Down

0 comments on commit 84f7fdd

Please sign in to comment.