Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event for when the menu is opening for the select components #4798

Closed
e111077 opened this issue Aug 28, 2023 Discussed in #4789 · 0 comments · Fixed by #4762 · May be fixed by X-oss-byte/pigweed#61
Closed

Event for when the menu is opening for the select components #4798

e111077 opened this issue Aug 28, 2023 Discussed in #4789 · 0 comments · Fixed by #4762 · May be fixed by X-oss-byte/pigweed#61
Assignees

Comments

@e111077
Copy link
Member

e111077 commented Aug 28, 2023

Discussed in #4789

Originally posted by MoaLeonhardt August 25, 2023
Concerning the select components (md-outlined-select and md-filled-select).

The regular HTML select component lacks events for when the select menu is opened. However, it looks like md-menu has an @opening event. If that event would be available on the material-web components md-outlined-select and md-filled-select it would be very useful.

For example, I'm using @lit-labs/task to create a select component where the menu data is not loaded until the menu is expanded. This is useful for cases when there's a lot of data, and normally no need to retrieve it, only when the user interacts with the select component.

Neither the focus event nor the click event can achieve this on their own, although it may be possible to combine them in a non-trivial way to find out when the menu is opened according to this stack overflow discussion.

PS. I'm sure other events such as menu closing, menu closed, menu opened, etc.. would be useful as well.

copybara-service bot pushed a commit that referenced this issue Aug 28, 2023
copybara-service bot pushed a commit that referenced this issue Aug 28, 2023
copybara-service bot pushed a commit that referenced this issue Aug 28, 2023
This will allow for the case of data fetching select options only when the select menu has opened.

We prepend the menu events with `select-*` and do not bubble because we have historically had the issue where a select inside a dialog or another menu has had event name clashes causing user runtime issues. I can probably keep them the same names but still not have them bubble if y'all think that's better.

fixes #4798

PiperOrigin-RevId: 560822352
@e111077 e111077 self-assigned this Aug 28, 2023
copybara-service bot pushed a commit that referenced this issue Aug 28, 2023
This will allow for the case of data fetching select options only when the select menu has opened.

We prepend the menu events with `select-*` and do not bubble because we have historically had the issue where a select inside a dialog or another menu has had event name clashes causing user runtime issues. I can probably keep them the same names but still not have them bubble if y'all think that's better.

See more discussion in linked github issue

fixes #4798

PiperOrigin-RevId: 560822352
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment