Skip to content

Commit

Permalink
fix(select): clicking select toggles the menu rather than just open
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 595540752
  • Loading branch information
Elliott Marquez authored and copybara-github committed Jan 4, 2024
1 parent 8942715 commit 043bbad
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions select/harness.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion select/internal/select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ export abstract class Select extends selectBaseClass {
}

private handleClick() {
this.open = true;
this.open = !this.open;
}

private handleFocus() {
Expand Down

0 comments on commit 043bbad

Please sign in to comment.