Skip to content

Commit

Permalink
Fixed regression on Hoverable blur event
Browse files Browse the repository at this point in the history
  • Loading branch information
s77rt committed Jan 24, 2023
1 parent 3c6609a commit f133eb4
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/components/Hoverable/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ class Hoverable extends Component {
}
},
onBlur: (el) => {
this.setIsHovered(false);
if (!this.wrapperView.contains(el.relatedTarget)) {
this.setIsHovered(false);
}

// Call the original onBlur, if any
const {onBlur} = this.props.children;
Expand All @@ -101,7 +103,12 @@ class Hoverable extends Component {
ref={el => this.wrapperView = el}
onMouseEnter={() => this.setIsHovered(true)}
onMouseLeave={() => this.setIsHovered(false)}
onBlur={() => this.setIsHovered(false)}
onBlur={(el) => {
if (this.wrapperView.contains(el.relatedTarget)) {
return;
}
this.setIsHovered(false);
}}
>
{ // If this.props.children is a function, call it to provide the hover state to the children.
_.isFunction(this.props.children)
Expand Down

0 comments on commit f133eb4

Please sign in to comment.