Closed Fifciu closed 4 months ago
I suspect the problem is caused by event bubbling. I think these handlers https://github.com/vueuse/motion/blob/5e2346ac1d2239821043bd3ad52148d099c2f818/src/features/eventListeners.ts#L48 catches events from child and sets hover to false.
As a temporary workaround I set @mouseout.stop @mouseleave.stop
on both img and #bugged-childs and it solves the problem.
I set child to pointer-events: none; and it worked.
I am pretty sure it's possible to solve without workarounds, so we still can have pointer events inside.
This behaviour is caused by this: https://github.com/vueuse/motion/blob/5e2346ac1d2239821043bd3ad52148d099c2f818/src/features/eventListeners.ts#L53-L56
I wonder if there is any use case for triggering this on mouseout
, which also triggers whenever mouse hovers over child elements? If not, we can probably remove this and only handle this on mouseleave
.
System info
Build Modules: -
Reproduction
Create the following component:
Play with "hovered" part. When you over on image or padding of main div then it works perfectly. But if you hover on child of #bugged-childs (h3, div, div>p) then hovered styles are removed.
Describe the bug
Hovered styles are removed when we hover on grandchild and it's descendants.
Additional context
No response
Logs
No response