BrowserAnimationsModule breaks size calculations
See original GitHub issueπ bug report
Affected Package
@angular/platform-browser/animations
Is this a regression?
The latest version working was 5.2.3Description
When Angular router is used to navigate and a new component is loaded into router-outlet, the size retrieved from the new compoent in OnInit or AfterViewInit is wrong whenever BrowserAnimationsModule is used.In the StackBlitz example the FrameComponent gets loaded into router-outlet. In OnInit and AfterViewInit the size of the div #frame gets read by
this.frame.nativeElement.client[Width/Height]
When BrowserAnimationsModule is part of AppModule, the height of the div is completely wrong (should be the same as viewport height). If BrowserAnimationsModule does not get imported, the size of the div gets reported correctly.
This breaks any application that depends on size calculations.
π¬ Minimal Reproduction
https://stackblitz.com/edit/angular-rac6sy
- Load StackBlitz and open up the console (the sizes get logged there)
- Click on the link βClick Hereβ
- Check the logged size in the console (especially the height)
- Go to app.module and delete BrowserAnimationsModule from imports
- Reload and repeat the above process -> the size is now correct (viewport size)
π Your Environment
Angular Version:
NG 9.0.6
Chrome 80.0.3987.132
Firefox 74
Windows 10 1909
Anything else relevant?
May be related to #20290 but I am not sure if it is the exact same problem
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:12 (4 by maintainers)
Top Results From Across the Web
import { BrowserAnimationsModule } causing problems in ...
In two of my components I'm running some typescript to create a cursor animation which is breaking when i import BrowserAnimationsModule. NoΒ ...
Read more >In-Depth guide into animations in Angular - InDepth.Dev
Explore the various animation methods in Angular, their use cases, implementation, and some tips on performance, debugging, and reusability.
Read more >BrowserAnimationsModule - Angular
Configures the module based on the specified object. See also: BrowserAnimationsModuleConfig Β· static withConfigΒ ...
Read more >swiper | Yarn - Package Manager
Flexbox Layout: Swiper uses modern flexbox layout for slides layout, which solves a lot of problems and time with size caclulations. Such layout...
Read more >public/node_modules/@angular/animations/esm5/animations.js ...
n *\n * ```ts\n * // remember to include the BrowserAnimationsModule module for this to work...\n * import {AnimationBuilder} from '\\@angular/animations'Β ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@jelbourn If I understand it correctly there is not really a solution for a simple task like βscrolling something into view after the page was renderedβ without using zone-hacks or double change detection? Why is something basic like this not on a roadmap? And by βbasicβ I mean the feature, not the implementation, knowing it could be a lot of work.
βWorking as expectedβ is weird. We have a pretty solid inconsistency here. Depending on what modules you include in the project, rendering changes completely and APIβs suddenly return different values. I donβt know, it just doesnβt feel right. A framework should keep struggle away from the developers, not introduce confusion.
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.