Fixed the auto-close bug with usePopover()

This commit is contained in:
Aria Minaei 2021-09-02 12:19:27 +02:00
parent 1ff245f482
commit 944c670ca8
2 changed files with 3 additions and 3 deletions

View file

@ -59,12 +59,12 @@ const ProjectDetails: React.FC<{
}, [])
const [tooltip, openExportTooltip] = usePopover(
{pointerDistanceThreshold: 50},
{pointerDistanceThreshold: 50, closeWhenPointerIsDistant: false},
() => (
<ExportTooltip>
This will create a JSON file with the state of your project. You can
commit this file to your git repo and include it in your production
bundle.{' '}
bundle.
<a href="https://docs.theatrejs.com/export.html" target="_blank">
Here is a quick guide on how to export to production.
</a>

View file

@ -48,7 +48,7 @@ export default function usePopover(
const portalLayer = useContext(PortalContext)
const onPointerOutside = useMemo(() => {
if (opts.closeOnClickOutside === false) return undefined
if (opts.closeWhenPointerIsDistant === false) return undefined
return {
threshold: opts.pointerDistanceThreshold ?? 100,
callback: close,