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

mat-slide-toggle unexpected animation in certain conditions #14488

Closed
BartoszWasiluk opened this issue Dec 12, 2018 · 3 comments
Closed

mat-slide-toggle unexpected animation in certain conditions #14488

BartoszWasiluk opened this issue Dec 12, 2018 · 3 comments
Assignees
Labels
area: material/slide-toggle P5 The team acknowledges the request but does not plan to address it, it remains open for discussion
Projects

Comments

@BartoszWasiluk
Copy link

What is the expected behavior?

MatSlideToggle shouldn't display an animation after rendering with given state

What is the current behavior?

MatSlideToggle display a slide animation from off -> on in certain conditions

What are the steps to reproduce?

https://stackblitz.com/edit/angular-pzaey9?file=animation-bug.component.ts
Click EDIT -> then click the "SAVE WITHOUT BUG" button -> it's expected bahviour
Click EDIT -> then click the "SAVE WITH BUG" button -> unexpected animation

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Angular version: 7.1.3
Material Version: 7.1.1
OS: Windows10 / Chrome 70.0.3538.110 (64-bit) (it works well on Firefox, Edge, IE11)
TS: ~3.1.1

Is there anything else we should know?

Making one of the following fixes this behaviour:

  • removing animation from Component declaration (I need it in my component)
  • moving button above SlideToggle
  • setting additional *ngIf on SlideToggle
@devversion
Copy link
Member

I tried looking into that, but this doesn't really look like a bug specific to Angular Material.

This is with animations added

image

This is without animations added

image


It looks like something causes a style recalculation if the element is being removed. At first glance I couldn't find anything specific to @angular/animations that would enforce a style recalculation, but I suspect that something in there causes the style recalculation.

We should also note that clicking on the Save with bug button causes the active browser element to be blurred due to element removal.

@devversion devversion added the P5 The team acknowledges the request but does not plan to address it, it remains open for discussion label Jan 21, 2019
@devversion
Copy link
Member

I'm closing this issue as there haven't been any other reports. It's most likely a bug in Angular animations, and we should report an issue there. On our end, I don't think we are doing anything special for the slide-toggle.

@devversion devversion added this to Triaged in triage #1 via automation May 25, 2020
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jun 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: material/slide-toggle P5 The team acknowledges the request but does not plan to address it, it remains open for discussion
Projects
No open projects
triage #1
  
Triaged
Development

No branches or pull requests

3 participants