Skip to content

bug(sidenav): sidenav width "jumps" when a scrollbar is added #22965

Open
@dario-piotrowicz

Description

@dario-piotrowicz

Reproduction

Use StackBlitz to reproduce your issue:

Steps to reproduce:

  1. Click on the hamburger icon to open the menu
  2. Click on "Add Item" until a scrollbar appear
  3. notice behaviour
  4. Can be repeated by clicking on "Remove Item" until the scrollbar disappears and then "Add" until it reappears

Expected Behavior

When the scrollbar needs to appear, the navbar width should be increased so that it can fit the scrollbar without delay
(possibly the width increase should happen before the scrollbar appears)

Actual Behavior

When the scrollbar needs to appear, it first appears and then the navbar increases in width so that it can fit the scrollbar
(possibly the width increase should happen before the scrollbar appears)

(not the best user experience)

Screenshot

From stackblitz:
Peek 2021-06-12 15-23

From Angular.io/docs (at least I believe that it's the same bug):
nav_last_issue
(here you can see the chevron icons jumping when the scrollbar appears)
(I mentioned the issue here: angular/angular#42552)

Environment

  • Angular: 12
  • CDK/Material: 12.0.4
  • Browser(s): Version 91.0.4472.101
  • Operating System (e.g. Windows, macOS, Ubuntu): Ubuntu 20.04.2 LTS

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4A relatively minor issue that is not relevant to core functionsarea: material/sidenav

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions