Toasts infinite loop when hovering closeButton
nigellima opened this issue Β· comments
Describe the feature / bug π:
There is a point in the screen which the the toasts with closeButton get into an infinite loop between expand/default appearance when hovering the close button
Steps to reproduce the bug π:
- Open a few toasts with closeButton
- Hover the close button and move the mouse to the left
I had the same problem with a button positioned on the top-right, in the same position where the toast
will render
This happens in my case too. This is caused since The mouse gets near to the container that triggers the OnMouseEnter
and onMouseLeave
again and again.
Can be resolved using a small hack by having a small time gap between expand and collapse.
[data-sonner-toast][data-expanded='false'][data-front='false'] {
height: auto;
animation: changeHeight 0s ease-in-out 150ms forwards;
}
@keyframes changeHeight {
0% {
height: 0px
}
100% {
height: var(--front-toast-height)
}
}