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

Created on 15 May 2017  路  7Comments  路  Source: angular/components

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?

P4

Most helpful comment

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>

All 7 comments

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

Here is a current reproduction

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>

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

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

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._

Was this page helpful?
0 / 5 - 0 ratings