Skip to content

Commit

Permalink
Remove is hovered state on mouse leave instead of mouse out
Browse files Browse the repository at this point in the history
Mouseleave and mouseout are similar but differ in that mouseleave does not bubble and mouseout does. This means that mouseleave is fired when the pointer has exited the element and all of its descendants, whereas mouseout is fired when the pointer leaves the element or leaves one of the element's descendants (even if the pointer is still within the element).

We were running into issues where navigation link li tag is hovered classnames were being removed when hovering over the navigation link's text. Using mouseleave instead of mouseout resolves the problem
  • Loading branch information
jeyip committed Feb 4, 2021
1 parent 0105c9a commit 1a4927a
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export function useIsHovered( ref ) {
}

if ( isHovered ) {
return addListener( 'mouseout', false );
return addListener( 'mouseleave', false );
}

if ( isOutlineMode || isNavigationMode ) {
Expand Down

0 comments on commit 1a4927a

Please sign in to comment.