Skip to content

Commit

Permalink
πŸ› Tooltip: attempt to fix flicker issue (#3695)
Browse files Browse the repository at this point in the history
* πŸ› Tooltip: attempt to fix flicker issue

* remove unused import

* bump version for next release

* revert version number
  • Loading branch information
oddvernes authored Dec 10, 2024
1 parent 8596afd commit d902f48
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/eds-core-react/src/components/Tooltip/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
typographyTemplate,
bordersTemplate,
mergeRefs,
useIsomorphicLayoutEffect,
} from '@equinor/eds-utils'
import { tooltip as tokens } from './Tooltip.tokens'
import {
Expand Down Expand Up @@ -119,6 +118,7 @@ export const Tooltip = forwardRef<HTMLDivElement, TooltipProps>(
context,
middlewareData: { arrow: { x: arrowX, y: arrowY } = {} },
placement: finalPlacement,
elements,
} = useFloating({
placement,
open,
Expand Down Expand Up @@ -190,11 +190,12 @@ export const Tooltip = forwardRef<HTMLDivElement, TooltipProps>(
}),
})

useIsomorphicLayoutEffect(() => {
if (shouldOpen && open) {
refs.floating.current?.showPopover()
useEffect(() => {
if (!elements.floating) return
if (elements.floating.isConnected && shouldOpen && open) {
elements.floating.showPopover()
}
}, [open, shouldOpen, refs.floating])
}, [open, shouldOpen, elements.floating])

const TooltipEl = (
<StyledTooltip
Expand Down

0 comments on commit d902f48

Please sign in to comment.