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(sidenav): scroll strategy not taken, when inside mat-sidenav-content #24716

Open
1 task
Ju-lia opened this issue Apr 1, 2022 · 4 comments
Open
1 task
Labels
area: material/select P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@Ju-lia
Copy link

Ju-lia commented Apr 1, 2022

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

mat-select inside mat-sidenav-content always has BlockScrollStrategy, no matter which strategy is injected with token MAT_SELECT_SCROLL_STRATEGY

Reproduction

Add a mat-select in mat-sidenav-content and change scroll strategy for example to reposition
-> scroll keeps beeing blocked

I added an example here:
https://stackblitz.com/edit/angular-ghcbzc?file=src/material.module.ts

I added the autocomplete component, to test the strategy. For autocomplete it seems to work fine.

Expected Behavior

Scroll strategy should be honored

Actual Behavior

Scroll strategy is always block

Environment

  • Angular: 13
  • CDK/Material: 13
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows
@Ju-lia Ju-lia added the needs triage This issue needs to be triaged by the team label Apr 1, 2022
@andrewseguin andrewseguin added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent area: material/select and removed needs triage This issue needs to be triaged by the team labels Apr 13, 2022
@volvachev
Copy link
Contributor

Hi, after investigation I've found that mat-select uses hasBackdrop under the hood, which doesn't allow to scroll even with enabled reposition strategy. And it isn't used in autocomplete, backdrop click is handled by focus.

As I understand if mat-select was implemented over focus, it wouldn't be affected by hasBackdrop.
There is some another solution which allows to scroll and to use backdrop, but I haven't found such approach in cdk yet.
@crisbeto

@KostyaTretyak
Copy link

KostyaTretyak commented May 1, 2022

Also sidenav not working in Google Chrome with anchorScrolling: 'enabled', see stackblitz

@PabloPerezAguilo
Copy link

If you remove the sidenav the behaviour is the same (autocomplete works, select doesn't). Could the problem be related to the scrolling component not having a scrolling predecessor?

I tried cdk-scrollable in the component but didnt work

https://stackblitz.com/edit/angular-ghcbzc-frs81n?file=src%2Fapp%2Fsidenav-overview-example.html

@NatalieLukaniuk
Copy link

The same defect is present for the datepicker component. MAT_DATEPICKER_SCROLL_STRATEGY doesn't affect background scroll if the datepicker is inside mat-sidenav-content.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: material/select P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

No branches or pull requests

6 participants