Skip to content

Commit

Permalink
fix(Tooltip): restore focus to trigger element
Browse files Browse the repository at this point in the history
only occurs if focus is not applied to another element after blur
  • Loading branch information
emyarod committed May 18, 2021
1 parent eaa6261 commit ed67a46
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/react/src/components/Tooltip/Tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,10 @@ class Tooltip extends Component {
}
if (!open && tooltipBody && tooltipBody.id === this._tooltipId) {
this._tooltipDismissed = true;
const currentActiveNode = event?.relatedTarget;
if (!currentActiveNode && document.activeElement === document.body) {
this._triggerRef?.current.focus();
}
}
});
};
Expand Down

0 comments on commit ed67a46

Please sign in to comment.