Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug(scrollPositionRestoration): adding angular material to a project causes a bug with scrolling. #24407

Closed
KostyaTretyak opened this issue Feb 14, 2022 · 5 comments
Labels
needs: clarification The issue does not contain enough information for the team to determine if it is a real bug needs triage This issue needs to be triaged by the team

Comments

@KostyaTretyak
Copy link

KostyaTretyak commented Feb 14, 2022

Description

If you install the default Angular project and then add default Angular Material to it, you can see a bug with scrolling.

Reproduction

Steps to reproduce:

Step 1:

ng new mat-scroll-bug --routing

Step 2:

In AppRoutingModule setup this:

RouterModule.forRoot(routes, { scrollPositionRestoration: 'enabled' }),

Step 3:

Create a component with one paragraph of content.

Step 4:

Create second component with own path and long page. Go to first component and create link to this second component.

Step 5:

Start the application, open first component and click link to second component (with long page).

Step 6:

Press "back" button on the browser and then press "forward" to go back to the long page.
For now, Angular scrolling to bottom as expected.

Step 7:

ng add @angular/material

Step 8:

Press "back" button on the browser and then press "forward" to go back to the long page.
For now, Angular scrolling, but not at the bottom.

Related info

GIF

mat-scroll-bug

Expected Behavior

Angular should scrolling to the bottom of page.

Actual Behavior

Angular scrolling, but not at the bottom.

Environment

Angular CLI: 13.2.3
Node: 16.13.2
Package Manager: yarn 1.22.1
OS: linux x64

Angular: 13.2.2
... animations, cdk, common, compiler, compiler-cli, core, forms
... material, platform-browser, platform-browser-dynamic, router

Package Version

@angular-devkit/architect 0.1302.3
@angular-devkit/build-angular 13.2.3
@angular-devkit/core 13.2.3
@angular-devkit/schematics 13.2.3
@angular/cli 13.2.3
@schematics/angular 13.2.3
rxjs 7.5.4
typescript 4.5.5

@KostyaTretyak KostyaTretyak added the needs triage This issue needs to be triaged by the team label Feb 14, 2022
@andrewseguin
Copy link
Contributor

Thanks for the issue @KostyaTretyak - I don't see what problem Material may be adding. Can you also provide a stackblitz showing what it looked like before adding Material? That would make it easier to identify the difference between the two

@andrewseguin andrewseguin added the needs: clarification The issue does not contain enough information for the team to determine if it is a real bug label Apr 27, 2022
@KostyaTretyak
Copy link
Author

@andrewseguin, I just saw that this bug appears after adding BrowserAnimationsModule to the project. This is exactly what happens with the ng add @angular/material command. So the problem, really, is not in the material.

@KostyaTretyak
Copy link
Author

Related bug angular/angular#38341

@KostyaTretyak
Copy link
Author

By the way, NoopAnimationsModule has same issue. So, any @angular/material user who uses Google Chrome will have this bug.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jun 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs: clarification The issue does not contain enough information for the team to determine if it is a real bug needs triage This issue needs to be triaged by the team
Projects
None yet
Development

No branches or pull requests

2 participants