Skip to content

Autocomplete scrolling doesn't work in an element with overflow:auto #4557

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

Closed
Zefling opened this issue May 15, 2017 · 7 comments
Closed

Autocomplete scrolling doesn't work in an element with overflow:auto #4557

Zefling opened this issue May 15, 2017 · 7 comments
Assignees
Labels
P4 A relatively minor issue that is not relevant to core functions

Comments

@Zefling
Copy link

Zefling commented May 15, 2017

Bug, feature request, or proposal:

Scroll position off autocomplete is not good if the parent scrolling element is not body.

What is the expected behavior?

Not scroll the page or scroll at the good position.

What is the current behavior?

The autocomplete list is static.

What are the steps to reproduce?

Plunker template: https://plnkr.co/edit/54OGBu?p=preview

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

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

Test with Angular 4.1.2 & Material 2.0.0-beta.5

Is there anything else we should know?

@fxck
Copy link
Contributor

fxck commented Jun 18, 2017

#3413 same problem I think

@dbartumeu
Copy link

I'm having the same problem...

Plunker template: https://plnkr.co/edit/g9wLPm6Umafsp069upM3?p=preview

Which versions of Angular, Material?

Test with Angular 4.3.3 & Material 2.0.0-beta.6

@josephperrott
Copy link
Member

Here is a current reproduction

@josephperrott josephperrott added the P4 A relatively minor issue that is not relevant to core functions label Sep 27, 2017
@crisbeto
Copy link
Member

That's because the autocomplete can't know which parent is scrollable. We could figure it out automatically, but it'll be very slow and unreliable. The way to let Material know that the autocomplete should reposition on scroll is to add the cdkScrollable directive on the scrollable parent. E.g.

<div style="height: 400px; overflow: auto" cdkScrollable></div>

@Zefling
Copy link
Author

Zefling commented Sep 28, 2017

This not works for me.
Works it if the overflow: auto is in a parent component/module ?

@pandiyaavps
Copy link

That's because the autocomplete can't know which parent is scrollable. We could figure it out automatically, but it'll be very slow and unreliable. The way to let Material know that the autocomplete should reposition on scroll is to add the cdkScrollable directive on the scrollable parent. E.g.

<div style="height: 400px; overflow: auto" cdkScrollable></div>

thank you so much

@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
P4 A relatively minor issue that is not relevant to core functions
Projects
None yet
Development

No branches or pull requests

6 participants