angular/components

bug(Sidenav): Using scrollIntoView() with multiple sidenavs

Geschlossen

#20.447 geöffnet am 28.08.2020

 (2 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)TypeScript (6.650 Forks)batch import
P4area: material/sidenavhelp wanted

Repository-Metriken

Stars
 (24.044 Sterne)
PR-Merge-Metriken
 (Durchschn. Merge 3T 12h) (98 gemergte PRs in 30 T)

Beschreibung

Reproduction

https://angular-9-multiple-sidenav-scrollintoview-issue-1.stackblitz.io

Steps to reproduce:

  1. Close Sidenav 2 by clicking toggle button
  2. Run the following in browsers console: document.getElementsByClassName('mat-drawer-content')[0].scrollIntoView()

Expected Behavior

In this example nothing should happen.

Note: The scrollIntoView function works as intended. In this example nothing happens since content is too small to make page scrollable.

Actual Behavior

Entire page slides left. Notice how Sidenav 1 disappears. To better visualize the issue, you can at this point toggle sidenav 1. Button for sidenav 1 will no slide left out of view.

Environment

  • Angular: 9
  • CDK/Material: 9.0.1
  • Browser(s): IE 11
  • Operating System (e.g. Windows, macOS, Ubuntu): WIndows

Other Notes

This issue ONLY happens when Sidenav 2 is closed. There is no issue if Sidenav 1 is closed, or both sidenavs is closed or opened.

Contributor Guide