Skip to content

Commit

Permalink
πŸ› blind fix for "disconnected" popover (#3610)
Browse files Browse the repository at this point in the history
* πŸ› blind fix for "disconnected" popover

* try using isConnected

* try with timeout

* restore version

* fix package.json
  • Loading branch information
oddvernes authored Sep 16, 2024
1 parent 01184ec commit 3e3a95c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/eds-core-react/src/components/Popover/Popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
mergeRefs,
useToken,
outlineTemplate,
useIsomorphicLayoutEffect,
} from '@equinor/eds-utils'
import { popover as popoverToken } from './Popover.tokens'
import { useEds } from '../EdsProvider'
Expand Down Expand Up @@ -165,9 +164,13 @@ export const Popover = forwardRef<HTMLDivElement, PopoverProps>(

const { getFloatingProps } = useInteractions([useDismiss(context)])

useIsomorphicLayoutEffect(() => {
useEffect(() => {
if (open) {
refs.floating.current?.showPopover()
setTimeout(() => {
if (refs.floating.current?.isConnected) {
refs.floating.current.showPopover()
}
}, 1)
} else {
refs.floating.current?.hidePopover()
}
Expand Down

0 comments on commit 3e3a95c

Please sign in to comment.