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

Wrong initial animation not working in Angular production mode #1133

Open
ReneZeidler opened this issue Jul 28, 2023 · 0 comments
Open

Wrong initial animation not working in Angular production mode #1133

ReneZeidler opened this issue Jul 28, 2023 · 0 comments

Comments

@ReneZeidler
Copy link

ReneZeidler commented Jul 28, 2023

Bug description

When used in Angular with the production flag enabled, there are some issues with the animation the first time a tippy instance appears, as reported here: farengeyt451/ngx-tippy-wrapper#27

This is even more visible if you set moveTransition for a tippy. The first time such a tooltip appears, it gets animated flying in from the top left of the screen.

I tracked down the cause to the same issue that was reported here: #168

It's caused by UglifyJS pure_getters option, which is enabled by Angular's build process (and can't be disabled easily).

The solution in the original issue was to use void element.offsetHeight;, which apparently prevented the removal of the line by UglifyJS. I don't know what changed in the meantime, but with the current Angular version (16.1.6) and the included build tools the line gets removed again.

In the current version of Tippy, the relevant line is this:

void popper.offsetHeight;

It gets minified to this:
image
The call to offsetHeight is missing.

I fixed this issue by replacing void popper.offsetHeight; with popper.offsetHeight_ = popper.offsetHeight;. It's very ugly, but it tricks the minifier.

This technically isn't a bug in this library but rather with UglifyJS, but this is the easiest way to fix the issue that I have found that doesn't involve changing the whole build process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant