Skip to content

Commit

Permalink
fix: mouseenter wasn't being emitted when mouseover was emitted at th…
Browse files Browse the repository at this point in the history
…e same time (#351)
  • Loading branch information
marc2332 authored Oct 23, 2023
1 parent f801af8 commit b5fb10f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crates/core/src/events_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ impl EventsProcessor {
// All these events will mark the node as being hovered
// "mouseover" "mouseenter" "pointerover" "pointerenter"

// We clone this here so events emitted in the same batch that mark an element as hovered will not affect the other events
let hovered_elements = self.hovered_elements.clone();

// Emit valid events
for event in &events_to_emit {
let id = &event.node_id;
Expand All @@ -88,7 +91,7 @@ impl EventsProcessor {
| name @ "mouseenter"
| name @ "pointerover"
| name @ "pointerenter" => {
let is_hovered = self.hovered_elements.contains(id);
let is_hovered = hovered_elements.contains(id);

if !is_hovered {
self.hovered_elements.insert(*id);
Expand Down

0 comments on commit b5fb10f

Please sign in to comment.