mirror of
https://github.com/material-components/material-web.git
synced 2024-09-11 21:57:41 +03:00
fix(select): announce typeahead selection when select is closed
PiperOrigin-RevId: 561675276
This commit is contained in:
parent
3906b7f72a
commit
2c892c4114
@ -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[];
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user