diff --git a/src/components/primitives/TooltipPrimitive.tsx b/src/components/primitives/TooltipPrimitive.tsx index 7673546e..215578ca 100644 --- a/src/components/primitives/TooltipPrimitive.tsx +++ b/src/components/primitives/TooltipPrimitive.tsx @@ -63,6 +63,14 @@ export default function TooltipPrimitive({ : contentProp; + // Blur after clicking to prevent keyboard focus being stuck + // when tooltip is combined with a button + const blurActiveElement = () => { + if (document.activeElement instanceof HTMLElement) { + document.activeElement.blur(); + } + }; + return ( @@ -70,12 +78,18 @@ export default function TooltipPrimitive({ {includeButton ? - : + : {children} }