-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
No animation on ngbCollapse in Angular 11.1 in production build #3972
Comments
We'll need the reproduction scenario please. Demo site works fine. Please take a look at the Getting Help section in documentation and use the appropriate support channel. If you believe you've found a bug in this library then please:
|
@maxokorokov |
Trying to debug a little, I find out that after optimization the value of ngbCollapsingTransition at this line results undefined ng-bootstrap/src/collapse/collapse.ts Lines 78 to 83 in 74d3109
Hope it helps. |
Ok, this is caused by the Terser We have a export function reflow(element: HTMLElement) {
return (element || document.body).offsetHeight;
} In case of using ONLY // not inlined, if reflow is used in several places
classList.remove("collapse"),
classList.remove("collapsing"),
classList.remove("show"),
reflow(element),
classList.add("collapsing"),
// inlined, if used only once
classList.remove("collapse"),
classList.remove("collapsing"),
classList.remove("show"),
function(element) {
element || document
}(element),
classList.add("collapsing"), See angular/angular-cli#15761 for more details. On our side I'll fix it by using |
This is caused by the Terser `pure_getters` optimization. If used only once (ex. when importing ONLY `NgbCollapseModule`), the `reflow` function is broken: ```ts // source export function reflow(element: HTMLElement) { return (element || document.body).offsetHeight; } reflow(el); // inlined in production function(element) { element || document }(element) ``` Fixes ng-bootstrap#3972
This is caused by the Terser `pure_getters` optimization. If used only once (ex. when importing ONLY `NgbCollapseModule`), the `reflow` function is broken: ```ts // source export function reflow(element: HTMLElement) { return (element || document.body).offsetHeight; } reflow(el); // inlined in production function(element) { element || document }(element) ``` Fixes #3972
Bug description:
Since upgrade to Angular 11.1, ngbCollapse elements get no animation when built for production (ng build --prod).
Other directives like ngbTooltip work as usual.
Animation works regular in dev build even for ngbCollapse.
Link to minimally-working StackBlitz that reproduces the issue:
Don't know how to issue a production build on StackBlitz
Versions of Angular, ng-bootstrap and Bootstrap:
Angular 11.1.0
ng-bootstrap 9.0.2
The text was updated successfully, but these errors were encountered: