Skip to content

Commit

Permalink
Merge pull request Expensify#14507 from s77rt/hoverable-onblur
Browse files Browse the repository at this point in the history
Fixed regression on Hoverable blur event
  • Loading branch information
ctkochan22 authored Jan 24, 2023
2 parents 6f70a7d + f133eb4 commit 811dd58
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 811dd58

Please sign in to comment.