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

[MDCMenuSurface] Add feature to prevent mdc-menu-surface from closing with outside clicks

Open Ilanaya opened this issue 3 years ago • 0 comments

Feature Request

Encountered the case of opening a full-screen modal from mdc-menu. Both menu and modal should stay opened regardless of any user interactions(clicks in my case) in the modal area. Right now the handleBodyClick method intercepts user clicks and immediately closes mdc-menu, which is now what is want to happen. Please ask an example/more detailed explanation to reproduce if something is unclear.

Proposed solution

Add native ability for disabling greedy body click listener

Additional context

Solved this with manual removal of the body event listener with deregisterBodyClickListener when opening a modal and then add it again when modal is closed, but this doesn't look like a good solution for me. This might be considered as duplicate of https://github.com/material-components/material-components-web/issues/6188 but here I have a slightly different case, so decided to open a new one

Ilanaya avatar Nov 24 '22 13:11 Ilanaya