From f133eb4b536cd0fc8d7476720ae3cb3785ba6beb Mon Sep 17 00:00:00 2001 From: Abdelhafidh Belalia <16493223+s77rt@users.noreply.github.com> Date: Tue, 24 Jan 2023 09:42:06 +0100 Subject: [PATCH] Fixed regression on Hoverable blur event --- src/components/Hoverable/index.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/components/Hoverable/index.js b/src/components/Hoverable/index.js index dac3a4907614..2f10cca0c1e3 100644 --- a/src/components/Hoverable/index.js +++ b/src/components/Hoverable/index.js @@ -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; @@ -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)