tleunen / react-mdl

React Components for Material Design Lite
https://tleunen.github.io/react-mdl/
MIT License
1.76k stars 255 forks source link

[gh-pages] document.body.scrollTop should be reset to 0 on transition to new page #424

Open bogas04 opened 7 years ago

bogas04 commented 7 years ago

I tried to read the gh-pages source but couldn't understand it much.

Anyway, in case ReactRouter is being used, we can simply do following to Router

onUpdate={() => document.body.scrollTop = 0}
tleunen commented 7 years ago

The website is autogenerated, that's why ;) The code lives here if you want: https://github.com/react-mdl/react-mdl/tree/master/docs

bogas04 commented 7 years ago

Thanks !

Maybe we can use document.body here

    const content = document.body;
    if (content) {
        content.scrollTop = 0;
    }

I'll try to create a PR in evening.