Creating a unique error tooltip for customization.
In the initial state, the tooltip is styled with the .errorTooltipUnload
class:
.errorTooltipUnload {
animation: tooltipUnload 1s;
animation-fill-mode: forwards;
display: none;
}
This animation is used:
@keyframes tooltipUnload {
0% {
display: block;
opacity: 1;
}
100% {
opacity: 0;
display: none;
}
}
When the value of hasError
is set to true
, it switches to the .errorTooltipLoad
class which has the opposite effect of unload.
<div [ngClass]="{'errorTooltipLoad': hasError, 'errorTooltipUnload': !hasError}" id="loadError"></div>
The Issue
Upon setting hasError
to false, the div disappears without animation due to the default display: none
property.
Removing this property results in the tooltip appearing and disappearing on page load.
Is there a workaround to prevent the display: none
from affecting the element after the animation completes?