Materialize: "sidenav-overlay" div sometimes remains on screen when side-nav is closed

Created on 6 Nov 2016  路  13Comments  路  Source: Dogfalo/materialize

Hello,

This is something that did not happen with the previous version 0.97.7, but it does with the newest 0.97.8.
In mobile/touchable devices, when trying to hide/close the side-nav sliding the finger (not clicking), the action does not hide the "sidenav-overlay" div sometimes.

This is something you can check by yourselves in your home page (www.materializecss.com), and it only happens "sometimes" because it seems that sliding the finger widely it works (also clicking on the dark "sidenav-overlay" div), but sliding the finger not so widely then it does not work.

I see in your changelog that some "minor side nav fixes" were done. So, it makes sense that you could have broken something in the process, right?

I repeat that it did not happen with the previous version.

bug SideNav has-pr

Most helpful comment

(function($){
$(function(){
$('.button-collapse').sideNav({
closeOnClick: true
});
});
})(jQuery);

pass closeOnClick: true on SideNav initialization ..it will work

All 13 comments

Hello,
I am also able to reproduce the same problem. The main page stays partially overlaid if you slide fast to close the side navigation.
Thanks,
Alex

Same here. Even the official demo on materializecss.com/ has this issue.

(function($){
$(function(){
$('.button-collapse').sideNav({
closeOnClick: true
});
});
})(jQuery);

pass closeOnClick: true on SideNav initialization ..it will work

@basiljose1 I tried your solution, but no. It does not solve the problem at all.

3951 I think that this is the same issue.

(Sorry for my bad english...)

@acburst The issue is still there with the new version 0.98.0 and you can reproduce it here: http://materializecss.com/

In fact, it appeared in the version 0.97.8 (it was working correctly in 0.97.7).

Regards

Same problem here. I wrote this issue here first yesterday. https://gitter.im/Dogfalo/materialize Then found out there's the same issue already being discussed. Would be nice to have it fixed. Do you know how often these little updates come out, so when could it be possibly fixed?

Ok guys, it worked for me, but partially.

@JSMontoya @olivertylsar
Even when the sidenav-overlay is correctly removed with this fix, there is still something there when you click again on the menu icon. The side-nav tries to open.

So, additionally I added the call for the function removeMenu() after the line:
else if (!menuOut || velocityX > 0.3)

It worked completely for me.

I hope it helps!

@jrioromero Doesn't work for me. The sidenav-overlay is still there when i swipe the menu to the left. I still have to click somewhere to let it disappear.

@olivertylsar But did you include the fix from @JSMontoya? With this, the sidenav-overlay should dissapear. Then, including the call to the function removeMenu(), the additional click on the menu icon should not be necessary.

The code from @JSMontoya works perfectly! I just replaced

var $overlay = $('<div id="sidenav-overlay"></div>');

with

var $overlay = $('#sidenav-overlay'); if ($overlay.length === 0) { $overlay = $('<div id="sidenav-overlay"></div>'); }

in materialize.js and it works PERFECTLY! Did he make a pull request or should I?

@jrioromero OMG I just figured out that I switched script source to materialize.min.js in base template and didn't switch it back, forgot it and I kept on editing materialize.js which wasn't attached. 馃ぃ Now I got back to this issue after a few days, checked everything again and I couldn't believe it. 馃ぃ I'm sorry, it works like a charm, thank you guys! 馃槈

This was due to a queuing problem with the animations I believe. We've fixed in our v1-dev branch

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cope picture cope  路  3Comments

bradley-varol picture bradley-varol  路  3Comments

Robouste picture Robouste  路  3Comments

lpgeiger picture lpgeiger  路  3Comments

heshamelmasry77 picture heshamelmasry77  路  3Comments