material-web icon indicating copy to clipboard operation
material-web copied to clipboard

mwc-menu closes on selection

Open motiejunas opened this issue 5 years ago • 3 comments

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:

  1. Go to https://material-components.github.io/material-components-web-components/demos/menu/
  2. Click on OPEN GROUPED MENU
  3. Imagine that this is a multi select menu (didn't find better demo there)
  4. Select any option
  5. mwc-menu gets 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.

motiejunas avatar May 26 '20 06:05 motiejunas

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.

asyncliz avatar May 27 '20 22:05 asyncliz

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

yinonov avatar Nov 06 '20 08:11 yinonov

Any updates? Menu still closes when using mwc-check-list-item so I would assume this issue wasn't solve.

#6033

vdegenne avatar Sep 12 '22 16:09 vdegenne

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

e111077 avatar May 12 '23 21:05 e111077