fix(select): clicking select toggles the menu rather than just open

PiperOrigin-RevId: 595540752
This commit is contained in:
Elliott Marquez 2024-01-03 17:06:28 -08:00 committed by Copybara-Service
parent 89427158b7
commit 043bbad6f3
2 changed files with 11 additions and 1 deletions

View File

@ -57,6 +57,16 @@ export class SelectHarness extends Harness<Select> {
}
(await this.getItems()[index].getInteractiveElement()).click();
}
get isOpen() {
const menu = this.element.renderRoot.querySelector('md-menu')!;
if (!menu) {
throw new Error(
'Internal md-menu is not found. md-select may not have finished rendering when isOpen has been checked',
);
}
return menu.open;
}
}
// Private class (not exported)

View File

@ -575,7 +575,7 @@ export abstract class Select extends selectBaseClass {
}
private handleClick() {
this.open = true;
this.open = !this.open;
}
private handleFocus() {