The Sidenav is not working even on the new Starter Template Provided there were always Null Errors
Uncaught TypeError: Cannot read property 'M_Sidenav' of null at HTMLBodyElement._handleTriggerClick (materialize.js:5479)
_handleTriggerClick @ materialize.js:5479
What version?
You can see the error on this page:
http://next.materializecss.com/templates/starter-template/preview.html
Stretch the page until the menu shows & then click to reproduce.
Version: 1.0.0 Alpha-1
I get this error with Firefox using 1.0.0 Alpha-1:
Empty string passed to getElementById(). materialize.js:5479:32
I did some debugging I found out the problem:
The function getIdFromTrigger expects the data-target attribue to be available, but the documentation example uses data-activates .
Changing data-activates to data-target fixed this error & the menu is working.
Same issue on 1.0.0 Alpha-1. Should we get back to .100?
@peecaboo Try changing your data-activates attribute on the sidenav-trigger class element to data-target. I believe that will fix the problem for you.
Here's a picture:

Here's the getIdFromTrigger function:
https://github.com/Dogfalo/materialize/blob/v1-dev/js/global.js#L261
@matugm It worked! You are a real savior. I thank you
@matugm I thank you too XD
This is already the case in the newest templates
@

same error even if i have data-target.... any ideas ?
@stefancata92 Please create a new issue illustrating your example with a Codepen
@GeorgesGITHUB live example or codepen please, so we can help.
@GeorgesGITHUB live example or codepen please, so we can help.
nvm, it was a simple mistake. Works good
Try to set the id attribute in sidenav ul
<ul class="sidenav" id="left-sidebar"> <li><a href="/">Home</a></li> <li class="active"><a href="/">QA Bank</a></li> <li><a href="#">Blog</a></li> </ul>
Most helpful comment
@peecaboo Try changing your
data-activatesattribute on thesidenav-triggerclass element todata-target. I believe that will fix the problem for you.Here's a picture:
Here's the
getIdFromTriggerfunction:https://github.com/Dogfalo/materialize/blob/v1-dev/js/global.js#L261