Skip to content

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

Closed

Description

@Zefling

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?

Activity

  1. fxck commented on Jun 18, 2017

    @fxck
    Contributor

    #3413 same problem I think

  2. dbartumeu commented on Aug 18, 2017

    @dbartumeu

    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

  3. josephperrott commented on Sep 27, 2017

    @josephperrott
    Member

    Here is a current reproduction

  4. added
    P4
    on Sep 27, 2017
  5. crisbeto commented on Sep 27, 2017

    @crisbeto
    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>
  6. Zefling commented on Sep 28, 2017

    @Zefling
    Author

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

  7. pandiyaavps commented on Jan 23, 2019

    @pandiyaavps

    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

  8. angular-automatic-lock-bot commented on Sep 10, 2019

    @angular-automatic-lock-bot

    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.

  9. locked and limited conversation to collaborators on Sep 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P4

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions