I'm using Riot.js and I have a root element into which I render a different layout for login box and for the actual app. MDL version is 1.0.6.
I wasn't allowed to post images but screenshots can be found here. It's a bit complicated to setup this in codepen, so I won't do it yet.
If I skip the login and call upgradeAllRegistered()
or upgradeDom()
after the app is added to dom, everything works as expected.
However, if I first render the login screen, replace it with the app and call upgradeDom()
again, the layout doesn't work anymore. The header is not at top.
I've inspected the dom using diff
and it's identical in both cases. It starts like this:
<div id="app" riot-tag="app">
<div class="mdl-layout__container">
<div class="mdl-layout mdl-js-layout mdl-layout--fixed-drawer mdl-layout--fixed-header has-drawer is-upgraded" data-upgraded=",MaterialLayout">
<header class="mdl-layout__header mdl-color--primary mdl-color-text--primary-contrast is-casting-shadow">
<div class="mdl-layout__drawer-button"><i class="material-icons">menu</i></div>
<div class="mdl-layout__header-row">
<span class="mdl-layout-title">Home</span>
...
I don't believe this happens just with riot but with other frameworks too. I guess the the issue is within the MaterialLayout
which doesn't work correctly if initialized multiple times. The layout is based on the dashboard example.
Any suggestions how to reset the layout? If not possible, I can always do a full refresh after login.