Skip to content

Commit

Permalink
fix(select): announce typeahead selection when select is closed
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 561675276
  • Loading branch information
Elliott Marquez authored and copybara-github committed Aug 31, 2023
1 parent 3906b7f commit 2c892c4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions select/internal/select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export abstract class Select extends LitElement {
@state() private focused = false;
@state() private open = false;
@query('md-menu') private readonly menu!: Menu|null;
@query('#label') private readonly labelEl!: HTMLElement;
@queryAssignedElements({slot: 'leadingicon', flatten: true})
private readonly leadingIcons!: Element[];

Expand Down Expand Up @@ -317,6 +318,7 @@ export abstract class Select extends LitElement {
return;
}

this.labelEl?.setAttribute?.('aria-live', 'polite');
const hasChanged = this.selectItem(
lastActiveRecord[TYPEAHEAD_RECORD.ITEM] as SelectOption);

Expand Down Expand Up @@ -428,6 +430,7 @@ export abstract class Select extends LitElement {
* active items.
*/
private async handleOpening(e: Event) {
this.labelEl?.removeAttribute?.('aria-live');
this.redispatchEvent(e);

const items = this.menu!.items;
Expand Down

0 comments on commit 2c892c4

Please sign in to comment.