-
Notifications
You must be signed in to change notification settings - Fork 14
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
Animation doesn't work the first time triggering tippy #27
Comments
Hello @Steb95. Sorry for delay. I reproduce this bug, thanks! I'll try to figure out what is going wrong. |
Seems the problem in angular and buildOptimizer. Issue recreates with latest vanilla |
Thank you for your investigations! I hope they'll provide a better solution than the ones suggested here... |
The issue is this line in tippy.js which gets removed by the optimizer: https://github.com/atomiks/tippyjs/blob/ad85f6feb79cf6c5853c43bf1b2a50c4fa98e7a1/src/createTippy.ts#L986 I fixed this in a very hacky way by running this script before my production builds: import replaceInFile from 'replace-in-file';
const result = await replaceInFile.replaceInFile({
files: 'node_modules/tippy.js/dist/tippy*.js',
from: 'void popper.offsetHeight',
to: 'popper.offsetHeight_ = popper.offsetHeight',
});
console.log(result); It's very ugly, but better than removing whole optimization steps completely (which doesn't look easy with Angular's default build setup anyways). |
This issue can now also be observed in the demo: Scroll to the section "Smooth transitions" and hover over one of the example buttons. The first time after page load, the tooltip flies in across the screen from the top left corner of the page. This does not happen for any subsequent tooltips. |
Describe the bug
When specifying an animation (such as "shift-toward") the first time hovering/clicking on the element that triggers a tippy the animation doesn't work (it has only a fade effect, not the "shift-toward"). It works perfectly the first time it disappears (but not the first time it appears) and from the second time appearing onwards. It only happens in configuration production.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The animation should work even the first time the tippy appears, not only from the second time onwards.
Screenshots
Desktop (please complete the following information):
Smartphone (please complete the following information):
Not tested on smartphone
Environment context
The text was updated successfully, but these errors were encountered: