components icon indicating copy to clipboard operation
components copied to clipboard

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

Open raymondkarstensen opened this issue 6 years ago • 4 comments

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.

raymondkarstensen avatar Aug 28 '20 12:08 raymondkarstensen

I suspect that may have to use display: none when hiding the sidenavs instead of the visibility: hidden we have now, but it can cause issues with the animation.

crisbeto avatar Aug 30 '20 10:08 crisbeto

Did a quick test and changed from visibility: hidden to display: none on the mat-sidenav element, and the page did not move left as described in issue.

raymondkarstensen avatar Aug 30 '20 11:08 raymondkarstensen

We are closing this issue, because we've determined, using a semi-automated process, that it is no longer relevant, has low engagement, or it does not have enough information to proceed. Feel free to comment if you think the issue should be reopened, or open a new issue with the latest version of our code instead.

crisbeto avatar May 29 '26 12:05 crisbeto

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.