The RouterModule anchor scroll is based on the viewport scrollable area, as mat-sidenav-container sets ifself as 100% height when used with the fullscreen attribute, there's no viewport overflow for RouterModule to change.
<mat-sidenav-container fullscreen>
<mat-sidenav-content></mat-sidenav-content>
</mat-sidenav-content>
In the example above, all the scrollable content lives inside mat-sidenav-content.
Is there a way for RouterModule to use mat-sidenav-container instead of the viewport as a scrolling container reference?
See the StackBlitz Example. See the working version without fullscreen.
For an Angular/Angular Material 16 application with mat-sidenav-container in app.component.html, I was able to get anchor scrolling working by adding the following css to AppComponent:
You'll want to test in your own application to make sure this doesn't mess up any other scrolling behavior.