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

Scrollable overlays not staying attached when inside tabs #8405

Closed
alexw10 opened this issue Nov 13, 2017 · 5 comments · Fixed by #16344
Closed

Scrollable overlays not staying attached when inside tabs #8405

alexw10 opened this issue Nov 13, 2017 · 5 comments · Fixed by #16344
Assignees
Labels
area: cdk/overlay P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@alexw10
Copy link

alexw10 commented Nov 13, 2017

Bug, feature request, or proposal:

Seems like this a bug unless someone can point me in a direction why what I have doesn't work.

What is the expected behavior?

When applying the cdkScrollable class I would expect the overlay to stay attached to the element

What is the current behavior?

Does not stay attached to the element

What are the steps to reproduce?

Providing a StackBlitz/Plunker (or similar) is the best way to get the team to see your issue.

Plunker starter (using on @master): https://goo.gl/uDmqyY

StackBlitz starter (using latest npm release): https://goo.gl/wwnhMV

Here is a StackBlitz:
https://stackblitz.com/edit/angular-material2-issue-yqzqdh

In the above I am applying the cdkScrollable class but it still does not seem to stay attached properly. Any ideas why? I believe I have it in the right spot which is on the element that is scrolling.
Tried it other places as well but still no luck.

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

Would like to use overlay components inside tabs.

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

Is there anything else we should know?

@willshowell
Copy link
Contributor

Definitely wait for an official response, but I was able to get it to work like this,

<mat-tab-group>
  <mat-tab label="Tab 1">
    <div cdkScrollable style="overflow-y: auto; height: 200px">
      <!-- ... -->
    </div>
  </mat-tab>
  <mat-tab label="Tab 2">Content 2</mat-tab>
</mat-tab-group>

@alexw10
Copy link
Author

alexw10 commented Nov 14, 2017

Yup, can confirm what you suggested does work @willshowell however I feel like wherever you put the cdkScrollable if that is the element that is scrolling for example my tab content is the part that is that should add it to the ScrollDispatcher and properly keep the element attached. I feel like this is still an issue will wait for official response as well. but will go with what you suggested for now @willshowell thanks! :)

@crisbeto crisbeto added the P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent label Nov 28, 2017
crisbeto added a commit to crisbeto/material2 that referenced this issue Dec 12, 2017
Since the tab body content can be scrollable and consumers don't have access to the DOM element, we have to mark it as a `CdkScrollable` in order to allow for overlays inside the tabs to reposition.

Fixes angular#8405.
@alexw10
Copy link
Author

alexw10 commented Jan 3, 2018

@crisbeto any ETA on when your PR will be merged?

crisbeto added a commit to crisbeto/material2 that referenced this issue Jul 21, 2018
Since the tab body content can be scrollable and consumers don't have access to the DOM element, we have to mark it as a `CdkScrollable` in order to allow for overlays inside the tabs to reposition.

Fixes angular#8405.
crisbeto added a commit to crisbeto/material2 that referenced this issue Nov 25, 2018
Since the tab body content can be scrollable and consumers don't have access to the DOM element, we have to mark it as a `CdkScrollable` in order to allow for overlays inside the tabs to reposition.

Fixes angular#8405.
crisbeto added a commit to crisbeto/material2 that referenced this issue Jun 20, 2019
Since the tab body content can be scrollable and consumers don't have access to the DOM element, we have to mark it as a CdkScrollable in order to allow for overlays inside the tabs to reposition.

Fixes angular#8405.
@tommymonk
Copy link

Any update on this ?

annieyw pushed a commit that referenced this issue Feb 9, 2021
Since the tab body content can be scrollable and consumers don't have access to the DOM element, we have to mark it as a CdkScrollable in order to allow for overlays inside the tabs to reposition.

Fixes #8405.
annieyw pushed a commit that referenced this issue Feb 9, 2021
Since the tab body content can be scrollable and consumers don't have access to the DOM element, we have to mark it as a CdkScrollable in order to allow for overlays inside the tabs to reposition.

Fixes #8405.

(cherry picked from commit 24d20fb)
annieyw pushed a commit that referenced this issue Feb 9, 2021
Since the tab body content can be scrollable and consumers don't have access to the DOM element, we have to mark it as a CdkScrollable in order to allow for overlays inside the tabs to reposition.

Fixes #8405.

(cherry picked from commit 24d20fb)
@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 Mar 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: cdk/overlay P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
5 participants