Skip to content

bug(snackbar): Snackbar appears twice when loading on app start #28601

Open
@karmasakshi

Description

@karmasakshi

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

Snackbar appears twice - once without animation, and once with. I could only see this when showing the snackbar in my root component. Please manually scrub the videos to see the two states.

Screen.Recording.2024-02-17.at.3.33.01.AM.mov
Screen.Recording.2024-02-17.at.3.27.11.AM.mov

Showing snackbar later works fine, as seen on docs: https://material.angular.io/components/snack-bar/examples.

Reproduction

StackBlitz link: https://stackblitz.com/edit/stackblitz-starters-shuyqd?file=src%2Fmain.ts

Steps to reproduce:

  1. Load snackbar in root component
  2. Reload

Expected Behavior

Snackbar should appear once, gracefully with fade-in animation. It does so when not loading in root component.

Actual Behavior

Snackbar appears once without animation and then fade-in animation kicks in.

Environment

  • Angular: 17.2.1
  • CDK/Material: 17.2.0
  • Browser(s): Consistently on Firefox and Safari, sometimes on Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu):

Metadata

Metadata

Assignees

No one assigned

    Labels

    P5The team acknowledges the request but does not plan to address it, it remains open for discussionarea: material/snack-bar

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions