Skip to content

Commit 043bbad

Browse files
Elliott Marquezcopybara-github
authored andcommitted
fix(select): clicking select toggles the menu rather than just open
PiperOrigin-RevId: 595540752
1 parent 8942715 commit 043bbad

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

select/harness.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,16 @@ export class SelectHarness extends Harness<Select> {
5757
}
5858
(await this.getItems()[index].getInteractiveElement()).click();
5959
}
60+
61+
get isOpen() {
62+
const menu = this.element.renderRoot.querySelector('md-menu')!;
63+
if (!menu) {
64+
throw new Error(
65+
'Internal md-menu is not found. md-select may not have finished rendering when isOpen has been checked',
66+
);
67+
}
68+
return menu.open;
69+
}
6070
}
6171

6272
// Private class (not exported)

select/internal/select.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ export abstract class Select extends selectBaseClass {
575575
}
576576

577577
private handleClick() {
578-
this.open = true;
578+
this.open = !this.open;
579579
}
580580

581581
private handleFocus() {

0 commit comments

Comments
 (0)