Skip to content

Commit

Permalink
fix(Tooltip): avoid stealing focus when dismissing with mouseclick
Browse files Browse the repository at this point in the history
  • Loading branch information
emyarod committed Jun 1, 2021
1 parent 309be08 commit 07cd72b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/react/src/components/Tooltip/Tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,11 @@ class Tooltip extends Component {
if (!open && tooltipBody && tooltipBody.id === this._tooltipId) {
this._tooltipDismissed = true;
const currentActiveNode = event?.relatedTarget;
if (!currentActiveNode && document.activeElement === document.body) {
if (
!currentActiveNode &&
document.activeElement === document.body &&
event.type !== 'click'
) {
this._triggerRef?.current.focus();
}
}
Expand Down

0 comments on commit 07cd72b

Please sign in to comment.