Skip to content

Commit e90687c

Browse files
committed
fix: chart parent should be relative
1 parent 965315e commit e90687c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/components/ChartInner.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import Raf from '../utils/Raf'
44
import Utils from '../utils/Utils'
55
import ChartContext from '../utils/ChartContext'
66

7+
import useIsomorphicLayoutEffect from '../hooks/useIsomorphicLayoutEffect'
8+
79
import Rectangle from '../primitives/Rectangle'
810

911
import Voronoi from './Voronoi'
@@ -158,6 +160,16 @@ export default React.forwardRef(function ChartInner(
158160
)
159161
})
160162

163+
useIsomorphicLayoutEffect(() => {
164+
if (
165+
ref.current &&
166+
ref.current.parentElement &&
167+
!ref.current.parentElement.style.position
168+
) {
169+
ref.current.parentElement.style.position = 'relative'
170+
}
171+
})
172+
161173
return (
162174
<div
163175
ref={ref}

0 commit comments

Comments
 (0)