diff --git a/packages/react-accessible-tooltip/src/Tooltip.js b/packages/react-accessible-tooltip/src/Tooltip.js index 2b2065a..f2a70d0 100644 --- a/packages/react-accessible-tooltip/src/Tooltip.js +++ b/packages/react-accessible-tooltip/src/Tooltip.js @@ -91,11 +91,20 @@ class Tooltip extends Component { activeElement instanceof Element && target instanceof Element && this.container instanceof Element && - !this.container.contains(target) && // touch target not a tooltip descendent - this.state.isFocused // prevent redundant state change + !this.container.contains(target) // touch target not a tooltip descendent ) { - this.setState({ isFocused: false }); - activeElement.blur(); + // prevent redundant state change + if (this.state.isFocused) { + this.setState({ isFocused: false }); + } + // prevent redundant state change + if (this.state.isHovered) { + this.setState({ isHovered: false }); + } + // don't blur active element if outside + if (this.container.contains(activeElement)) { + activeElement.blur(); + } } else if ( activeElement instanceof Element && target instanceof Element &&