MatBlazor
MatBlazor copied to clipboard
click on Links doesn't scroll to top on MatBlazor's demo site
Describe the bug This can be reproduced on matblazor's website.
Click on new link, scroll position should reset to the top and not keeping previous page's scroll position. This happens when link is contained within MatDrawerContainer's MatDrawerContent
Solution: {edit: removed, the suggestion solution will cause side-effects}
To Reproduce Steps to reproduce the behavior:
- Go to 'https://www.matblazor.com/', open the drawer
- Click on {any link}
- Scroll down to 'the bottom'
- Click on {another link}
- Issue: scroll position is reserved from the previous page. Expected behavior: page should scroll to the top
Blazorfiddle link mock code: just the demo code: https://github.com/SamProf/MatBlazor/blob/master/src/MatBlazor.Demo/Shared/MainLayout.razor
Expected behavior page should scroll to the top
Screenshots
Additional context
Interesting bug. It doesn't appear to be anything with the NavLink. Definitley a bug. What are you thoughts on a solutions?
Any update on this?
I have not looked at it. Happens in https://blazorboilerplate.com/ as well.
@SamProf do you have any ideas?
This seems to be a Blazor specific issue that was resolved. Maybe you can take a look and sort out what is going on from there;
https://github.com/dotnet/aspnetcore/issues/10482
This seems to be a Blazor specific issue that was resolved. Maybe you can take a look and sort out what is going on from there;
Thanks but I cant figure it out. Is it possible to write JS to navigate to top of page? When I try this for example: https://www.syncfusion.com/faq/blazor/javascript-interop/how-do-i-scroll-to-the-top-position-in-a-blazor-page document.documentElement.scrollTop and document.body.scrollTop is always 0. Any ideas?
Okey I think I found something:
When I use a <MatDrawerContainer Style="height: 100vh; width: 100vw;" Class="mat">
the problem is there.
But when I remove height: 100vh it works as expected.