Skip to content

Commit

Permalink
fix: chart parent should be relative
Browse files Browse the repository at this point in the history
  • Loading branch information
tannerlinsley committed Jun 7, 2020
1 parent 965315e commit e90687c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/components/ChartInner.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import Raf from '../utils/Raf'
import Utils from '../utils/Utils'
import ChartContext from '../utils/ChartContext'

import useIsomorphicLayoutEffect from '../hooks/useIsomorphicLayoutEffect'

import Rectangle from '../primitives/Rectangle'

import Voronoi from './Voronoi'
Expand Down Expand Up @@ -158,6 +160,16 @@ export default React.forwardRef(function ChartInner(
)
})

useIsomorphicLayoutEffect(() => {
if (
ref.current &&
ref.current.parentElement &&
!ref.current.parentElement.style.position
) {
ref.current.parentElement.style.position = 'relative'
}
})

return (
<div
ref={ref}
Expand Down

0 comments on commit e90687c

Please sign in to comment.