question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Angular router animation exposing elements that was hidden by animation

See original GitHub issue

🐞 bug report

Affected Package

The issue is probably caused by package @angular/animations

Is this a regression?

Yes, in Angular 8.x this was ok.

Description

I’m trying to upgrade my Angular project from 8.x to 9. Once I’ve done following the upgrade instructions, I’ve noticed that on one page that contains inner animation on it that supposed to hide certain element, becomes visible during router animation. I synthesized the issue to small project that demonstrate the issue (can be also found in StackBlitz: https://stackblitz.com/edit/angular-jbcamx)

πŸ”¬ Minimal Reproduction

https://stackblitz.com/edit/angular-jbcamx

πŸ”₯ Exception or Error





🌍 Your Environment

Angular Version:




Angular CLI: 9.1.1
Node: 14.0.0
OS: win32 x64

Angular: 9.1.2
... animations, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.901.1
@angular-devkit/build-angular     0.901.1
@angular-devkit/build-optimizer   0.901.1
@angular-devkit/build-webpack     0.901.1
@angular-devkit/core              9.1.1
@angular-devkit/schematics        9.1.1
@angular/cdk                      9.2.1
@angular/cli                      9.1.1
@ngtools/webpack                  9.1.1
@schematics/angular               9.1.1
@schematics/update                0.901.1
rxjs                              6.5.5
typescript                        3.8.3
webpack                           4.42.0

Anything else relevant?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ofir-havivcommented, Apr 28, 2020

Thanks @ismailcherri for looking into it.

  1. You are right - after taking more carful look at my repro, I noticed that hidden part appears before at the entrance, while locally it expose itself during the leave. This is interesting, because if I download the stackblitz project as is, and run npm install and ng serve, my issue does reproduced (only locally). Downgrading to Angular 8 fixes the issue without code change.
  2. I did some more digging, and found something else that I can’t explain. in my test.component.ts where I defined the inner animation, I have wildcard state transition like * => * (I have only 2 states). If I change the transition to hide <=> show (it should be equivalent as I understand it), the issue that can be seen in stackblitz is solved without adding the height: 0px
1reaction
ismailcherricommented, Apr 28, 2020

Your example doesn’t work as intended or doesn’t demonstrate the bug correctly. Even when router animation is disabled, the issue is still there. The height: 0px takes some milliseconds to be applied. If you add it to the inline style, the issue is gone. Example:

template: `
  <p>outter text!</p>
  <button (click)="OnClick()">Expose</button>
  <div [@scrollAnimation]="AnimationState" style="overflow: hidden; height: 0px">
    <p>Inner Text</p>
  </div>`,
Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular animation gets hidden behind the other elements
I have the following angular animation which animates (move) the div from source to target coordinates. Issue 1: Somehow the animation isΒ ...
Read more >
Route transition animations
Illustrate a router transition animation by navigating between two routes, Home and About ... Animations can be defined directly inside your components.
Read more >
Ionic Routing And Router Animations In Angular
Ionic's router enables us to write routing animations and page ... The stack and hidden DOM elements are critical for Ionics pageΒ ...
Read more >
Practical, real-world animation examples with Angular
In this blog, I will who show six examples of practical, real-world animations using Angular's animation capability, and will explain in detail how...
Read more >
Interaction | NativeScript
Access CSS animations from code #. The simplest way to trigger a CSS animation is by changing the element className property: Example 15:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found