mdbootstrap / material-design-for-bootstrap

Important! A new UI Kit version for Bootstrap 5 is available. Access the latest free version via the link below.
https://mdbootstrap.com/docs/standard/
MIT License
9.34k stars 1.15k forks source link

SideNav disable body scrolling not consistent #186

Closed coreystinson2 closed 5 years ago

coreystinson2 commented 6 years ago

When using the SideNav feature on a mobile device opening the menu using the panEventHandler function ( dragging x-axis from the left-most corner of your device ) the disableScrolling method is call which stops the body from being scrollable.

Opening the menu using the element that the SideNav is initialised with, does not disable scrolling ( which i have found to cause inconsistencies in behaviour with my device, but no longer relevant if proposed solution is implemented. ).

Expected behavior

Opening SideNav, by panEventHandler or by click event on the element the SIdeNav is initialised with should produce the same behaviour on body scroll.

Actual behavior

Element click should disable body scrolling when SideNav is opened.

Your working environment and MDB version information

Can be reproduced on any of the live demo sites straight from mdb4 website. https://mdbootstrap.com/previews/docs/latest/html/skins/white-skin.html Version MDB PRO 4.5.9

Havn't been able to find the matching code in the repository, but local installation altering the following lines introduces the expected, consistent behaviour.

19665:  _this3.$sidenavOverlay = $('<div id="sidenav-overlay"></div>');
19666:  _this3.$body.append(_this3.$sidenavOverlay);
19667:  // disable body scrolling utilising same method from panEventHandler.
19668:  _this3.disableScrolling();
pglejzer commented 5 years ago

It's a bug. Thanks for you comment. We will check solution for that.