After transitioning to Angular material for a project, I encountered an issue with the navbar (now a toolbar) buttons that were meant to scroll to different sections on the page.
To achieve the desired toolbar shrink effect and reappear on scroll up, I had to place the content within a md-content component right after the toolbar. However, this change resulted in breaking all anchor links functionality...
I have been unable to find a solution to this problem so far. The anchor links only function properly when the scrollable element is set as the body, but this causes me to lose the shrink effect, ripple effect, and results in an odd sidenav appearance...
Below are snippets of the relevant code:
CSS:
body{
overflow-y: hidden;
}
#main-content{
height: 100vh;
}
HTML:
<md-toolbar md-scroll-shrink>
(...)
<md-button href="#leave-email">Click</md-button>
</md-toolbar>
<md-content id="main-content">
(...)
<md-button href="#leave-email">Click</md-button>
(lots of content)
<section id="leave-email">(...)</section>
</md-content>
None of the above buttons are functioning correctly. Previously, I utilized Angular smooth scroll for a smoother scroll experience, but I removed it while attempting to resolve this issue.