material-web
material-web copied to clipboard
mwc-menu closes on selection
Describe the bug
When using mwc-menu together with mwc-check-list-item any new selection closes the mwc-menu.
To Reproduce Steps to reproduce the behavior:
- Go to https://material-components.github.io/material-components-web-components/demos/menu/
- Click on
OPEN GROUPED MENU - Imagine that this is a multi select menu (didn't find better demo there)
- Select any option
mwc-menugets closed
Expected behavior
mwc-menu stays open.
Additional context
When using mwc-menu together with multi attribute my expectation would be that the menu remains open after a selection or, even better, some additional attribute such autoClose would work too.
We spoke with design, and we agree that this is a valid UX pattern. This needs to be upstreamed into the MDC foundation as an option to prevent the menu from closing.
Unlike our demo, which uses a list item with a checkmark icon, design recommends using a <mwc-check-list-item> with the checkbox graphic for a persistent multi-select list that would remain open until the user clicked outside the bounds of the menu.
following the code leads to the conclusion this is it's blocked by the lack of relevant setMulti method on mdc's select foundation
Why is material-components/material-components-web#6033 close then?
Seem like mwc's list depends on mdc's list foundation as well https://github.com/material-components/material-components-web-components/blob/d10fda0a0b663f1e0be185ac2735123ce227a33a/packages/list/mwc-list-base.ts#L66
Any updates?
Menu still closes when using mwc-check-list-item so I would assume this issue wasn't solve.
This is no longer reproducible on M3 with the keep-open attribute on item. Alternatively click event propagation can be prevented so that the click event does not reach the list item.
https://lit.dev/playground/#gist=7e8ac8a9e12275a0645fe7829fa85fdc