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

bug(MatSidenav): Overlay scroll strategies do not work in sidenavs and drawers. #19846

Closed
TrevorKarjanis opened this issue Jul 2, 2020 · 2 comments · Fixed by #19848
Closed
Assignees
Labels
area: material/sidenav P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@TrevorKarjanis
Copy link
Contributor

TrevorKarjanis commented Jul 2, 2020

Reproduction

https://stackblitz.com/edit/angular-ivy-ng8reg?file=src%2Fapp%2Fapp.component.ts

Steps to reproduce:

  1. Utilize an overlay or a component with an overlay in a mat-sidenav or mat-drawer that overflows.
  2. Declare cdkScrollable on the sidenav or drawer.
  3. Scroll the sidenav or drawer.

Expected Behavior

The overlay's scroll strategy is honored (e.g. the overlay remains fixed to its origin).

Actual Behavior

The sidenav's inner container, .mat-drawer-inner-container, handles the overflow and scrolls. Therefore, the cdkScrollable directive has no effect and the scroll strategy is not honored.

Environment

  • Angular: 10.0.2
  • CDK/Material: 10.0.1
  • Browser(s): Chrome 83.0.4103.116
  • Operating System (e.g. Windows, macOS, Ubuntu): macOS

Related Issues

Fix

CdkScrollable is declared on mat-sidenav-content but not .mat-drawer-inner-container.

Workaround

Place the following in your global styles, and declare CdkScrollable on the mat-sidenav.

.mat-drawer, .mat-sidenav {
  &[cdk-scrollable], &[cdkScrollable] {
    .mat-drawer-inner-container {
      overflow: visible;
    }
  }
}
@TrevorKarjanis TrevorKarjanis added the needs triage This issue needs to be triaged by the team label Jul 2, 2020
@crisbeto crisbeto self-assigned this Jul 3, 2020
@crisbeto crisbeto added area: material/sidenav has pr P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent and removed needs triage This issue needs to be triaged by the team labels Jul 3, 2020
crisbeto added a commit to crisbeto/material2 that referenced this issue Jul 3, 2020
Marks the sidenav's inner scrollable element as `cdkScrollable` so any overlays placed inside of it can update.

Fixes angular#19846.
crisbeto added a commit to crisbeto/material2 that referenced this issue Jul 3, 2020
Marks the sidenav's inner scrollable element as `cdkScrollable` so any overlays placed inside of it can update.

Fixes angular#19846.
Fixes angular#18453.
@dragosgr
Copy link

dragosgr commented Sep 9, 2020

I don't understand how this is supposed to help the autocomplete issue.

crisbeto added a commit to crisbeto/material2 that referenced this issue Dec 27, 2020
Marks the sidenav's inner scrollable element as `cdkScrollable` so any overlays placed
inside of it can update.

Fixes angular#19846.
Fixes angular#18453.
annieyw pushed a commit that referenced this issue Apr 6, 2021
Marks the sidenav's inner scrollable element as `cdkScrollable` so any overlays placed
inside of it can update.

Fixes #19846.
Fixes #18453.
annieyw pushed a commit that referenced this issue Apr 6, 2021
Marks the sidenav's inner scrollable element as `cdkScrollable` so any overlays placed
inside of it can update.

Fixes #19846.
Fixes #18453.

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

Successfully merging a pull request may close this issue.

3 participants