Skip to content

Commit

Permalink
fix(picker): correct attribute spelling of "aria-label" in dismiss bu…
Browse files Browse the repository at this point in the history
…tton
  • Loading branch information
majornista authored May 25, 2023
1 parent 0b56464 commit 5fc9b30
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/picker/src/Picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ export class PickerBase extends SizedMixin(Focusable) {
<div class="visually-hidden">
<button
tabindex="-1"
arial-label="Dismiss"
aria-label="Dismiss"
@click=${this.close}
></button>
</div>
Expand Down
11 changes: 11 additions & 0 deletions packages/picker/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ export function runPickerTests(): void {
await expect(el).to.be.accessible();
});
it('closes accessibly', async () => {
el.focus();
await elementUpdated(el);
expect(el.shadowRoot.activeElement).to.equal(el.button);
const opened = oneEvent(el, 'sp-opened');
el.open = true;
await opened;
Expand All @@ -104,12 +107,20 @@ export function runPickerTests(): void {
const accessibleCloseButton = document.querySelector(
'.visually-hidden button'
) as HTMLButtonElement;
expect(accessibleCloseButton).to.have.attribute(
'aria-label',
'Dismiss'
);

const closed = oneEvent(el, 'sp-closed');
accessibleCloseButton.click();
await closed;

await elementUpdated(el);

expect(el.open).to.be.false;
expect(el.shadowRoot.activeElement).to.equal(el.button);
expect(document.activeElement).to.eq(el);
});
it('accepts new selected item content', async () => {
const option2 = el.querySelector('[value="option-2"') as MenuItem;
Expand Down

0 comments on commit 5fc9b30

Please sign in to comment.