MudBlazor.StaticInput
MudBlazor.StaticInput copied to clipboard
MudDrawer with ClipMode.Never Does Not Close on Outside Click in Mobile View
Hi,
First of all thank you for this extension, it's very handful.
I'm facing an issue when the drawer's clip mode is DrawerClipMode.Never. Basically the only way to close it is to resize it.
I'd the suggest to add something like:
window.MudDrawerInterop = {
initialize: function () {
...
document.removeEventListener('click', this.handleOutsideClick);
document.addEventListener('click', this.handleOutsideClick);
},
...
handleOutsideClick: function (event) {
const mudDrawer = document.querySelector('.mud-drawer.mud-drawer--open');
if (!mudDrawer) return;
if (mudDrawer.contains(event.target) || event.target.closest('[data-mud-drawer-toggle]')) {
return;
}
const drawerId = mudDrawer.id ? mudDrawer.id : '_no_id_provided_';
MudDrawerInterop.toggleDrawer(drawerId);
},
That should fix the issue with DrawerClipMode.Never.
There is probably use cases we don't want this behaviour. What do you think?
Basic reproduction of the issue is quite simple. Just use ClipMode="DrawerClipMode.Never" on a MudDrawer with a mobile view the drawer goes over the burger button and you can't close it easily.