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

mat-menu not scrolled to top on first open #11790

Closed
diminutivesloop opened this issue Jun 14, 2018 · 2 comments · Fixed by #11859 or #14190
Closed

mat-menu not scrolled to top on first open #11790

diminutivesloop opened this issue Jun 14, 2018 · 2 comments · Fixed by #11859 or #14190
Assignees
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@diminutivesloop
Copy link

Bug, feature request, or proposal:

Bug

What is the expected behavior?

When opening a mat-menu with scrollable content the content should be scrolled to the top.

What is the current behavior?

When opening a mat-menu with scrollable content for the first time after it is created the content is scrolled down slightly.
image

What are the steps to reproduce?

https://stackblitz.com/edit/mat-menu-scroll-issue

What is the use-case or motivation for changing an existing behavior?

The top-most item in a menu should be fully visible after opening the menu.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Angular CLI: 6.0.3
Node: 8.11.1
OS: win32 x64
Angular: 6.0.2
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.3
@angular-devkit/build-angular     0.6.3
@angular-devkit/build-optimizer   0.6.3
@angular-devkit/core              0.6.3
@angular-devkit/schematics        0.6.3
@angular/cdk                      6.1.0
@angular/cli                      6.0.3
@angular/material                 6.1.0
@ngtools/webpack                  6.0.3
@schematics/angular               0.6.3
@schematics/update                0.6.3
rxjs                              6.1.0
typescript                        2.7.2
webpack                           4.8.3
@crisbeto crisbeto self-assigned this Jun 20, 2018
crisbeto added a commit to crisbeto/material2 that referenced this issue Jun 20, 2018
…rst time

Fixes a menu with a scrollable content not being scrolled to the top when it's opened for the first time. The issue seems to come from the fact that the browser is thrown off by us moving focus while the menu is still animating.

Fixes angular#11790.
@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent has pr labels Jun 20, 2018
@andrewseguin andrewseguin reopened this Nov 18, 2018
@andrewseguin
Copy link
Contributor

I'm running into this issue on v7.0.4, except its showing during animation. Looks like the fix resets scrollTop on animation done, but the scroll top is wrong during animation and looks janky

https://stackblitz.com/edit/angular-ej8quc?file=app/menu-overview-example.html

While the menu is animating open, the scroll top is set to 31px and then it resets to 0px once open.

screen shot 2018-11-17 at 9 53 45 pm

crisbeto added a commit to crisbeto/material2 that referenced this issue Nov 18, 2018
…scrollable menu

Originally in angular#11859 we introduced some logic that makes sure that the menu panel is always scrolled to the top when it's open. This works, but is janky, because the user can see the menu being scrolled down while it's animating. These changes move the logic, that reset the scroll position, from the `done` callback to `start`.

Fixes angular#11790.
jelbourn pushed a commit that referenced this issue Dec 19, 2018
…scrollable menu (#14190)

Originally in #11859 we introduced some logic that makes sure that the menu panel is always scrolled to the top when it's open. This works, but is janky, because the user can see the menu being scrolled down while it's animating. These changes move the logic, that reset the scroll position, from the `done` callback to `start`.

Fixes #11790.
josephperrott pushed a commit to josephperrott/components that referenced this issue Jan 14, 2019
…scrollable menu (angular#14190)

Originally in angular#11859 we introduced some logic that makes sure that the menu panel is always scrolled to the top when it's open. This works, but is janky, because the user can see the menu being scrolled down while it's animating. These changes move the logic, that reset the scroll position, from the `done` callback to `start`.

Fixes angular#11790.
@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 Sep 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
3 participants