Skip to content

Commit

Permalink
fix: work around dialog closing leaving pointer-events: none on the body
Browse files Browse the repository at this point in the history
  • Loading branch information
1egoman committed Sep 10, 2024
1 parent ea99a37 commit 3587e44
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions packages/web/src/components/navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,29 @@ export function SessionNavbar(props: SessionNavbarProps) {
<span>Create Srcbook</span>
<DropdownMenuShortcut>⌘N</DropdownMenuShortcut>
</DropdownMenuItem>
<DropdownMenuItem onClick={() => setShowGenSrcbookModal(true)}>
<DropdownMenuItem onClick={() => {
// FIXME: wrap this function calls in a setTimeout so that this runs after the
// dropdown menu at least starts closing (ie, removes `pointer-events: none;`)
//
// Otherwise the Dialog this setState call opens and the DropdownMenu will fight
// for control over the body tag styles.
setTimeout(() => {
setShowGenSrcbookModal(true);
}, 0);
}}>
<SparklesIcon className="mr-2 h-4 w-4" />
<span>Generate Srcbook</span>
</DropdownMenuItem>
<DropdownMenuItem onClick={() => setShowImportSrcbookModal(true)}>
<DropdownMenuItem onClick={() => {
// FIXME: wrap this function calls in a setTimeout so that this runs after the
// dropdown menu at least starts closing (ie, removes `pointer-events: none;`)
//
// Otherwise the Dialog this setState call opens and the DropdownMenu will fight
// for control over the body tag styles.
setTimeout(() => {
setShowImportSrcbookModal(true);
}, 0);
}}>
<ImportIcon className="mr-2 h-4 w-4" />
<span>Open Srcbook</span>
</DropdownMenuItem>
Expand Down

0 comments on commit 3587e44

Please sign in to comment.