diff --git a/src/components/Popover.tsx b/src/components/Popover.tsx index 27cc90d50..b29d717eb 100644 --- a/src/components/Popover.tsx +++ b/src/components/Popover.tsx @@ -107,7 +107,7 @@ export default function Popover({ const options = useMemo((): Options => { const modifiers: Options['modifiers'] = [ - { name: 'offset', options: { offset: [4, offset || 4] } }, + { name: 'offset', options: { offset: [0, offset || 4] } }, { name: 'arrow', options: { element: arrow, padding: 4 } }, ] if (contained) { diff --git a/src/components/Tooltip.tsx b/src/components/Tooltip.tsx index d9fa78ce2..4bba1b17a 100644 --- a/src/components/Tooltip.tsx +++ b/src/components/Tooltip.tsx @@ -2,7 +2,7 @@ import { Placement } from '@popperjs/core' import useHasFocus from 'hooks/useHasFocus' import useHasHover from 'hooks/useHasHover' import { HelpCircle, Icon } from 'icons' -import { ComponentProps, ReactNode, useRef } from 'react' +import { ComponentProps, ReactNode, useState } from 'react' import styled from 'styled-components/macro' import { IconButton } from './Button' @@ -35,11 +35,11 @@ export default function Tooltip({ offset, contained, }: TooltipProps) { - const tooltip = useRef(null) - const showTooltip = useTooltip(tooltip.current) + const [tooltip, setTooltip] = useState() + const showTooltip = useTooltip(tooltip) return ( - + ) }