Skip to content

Commit

Permalink
fix(non-modal-dialog-primitive): always use portal
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSisb committed Oct 2, 2023
1 parent 266222e commit ed673f5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .changeset/little-llamas-swim.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@twilio-paste/core": patch
"@twilio-paste/non-modal-dialog-primitive": patch
---

[Non-modal Dialog Primitive] Fix to always use a portal when rendering, even when using the state hook.
20 changes: 17 additions & 3 deletions packages/paste-core/primitives/non-modal-dialog/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
import {
type PopoverInitialState as NonModalDialogPrimitivePopoverInitialState,
type PopoverStateReturn as NonModalDialogPrimitiveStateReturn,
usePopoverState as _usePopoverState,
} from "@twilio-paste/reakit-library";

/*
* Fixes issue where the popover would not open in a portal
* when using the state hook directly
*/
export const useNonModalDialogPrimitiveState = (
options: NonModalDialogPrimitivePopoverInitialState,
): NonModalDialogPrimitiveStateReturn => {
return _usePopoverState({ modal: true, ...options });
};

export {
usePopoverState as useNonModalDialogPrimitiveState,
Popover as NonModalDialogPrimitive,
PopoverDisclosure as NonModalDialogDisclosurePrimitive,
PopoverArrow as NonModalDialogArrowPrimitive,
} from "@twilio-paste/reakit-library";

export type {NonModalDialogPrimitivePopoverInitialState, NonModalDialogPrimitiveStateReturn};
export type {
PopoverState as NonModalDialogPrimitiveState,
PopoverStateReturn as NonModalDialogPrimitiveStateReturn,
PopoverInitialState as NonModalDialogPrimitivePopoverInitialState,
PopoverProps as NonModalDialogPrimitiveProps,
PopoverDisclosureProps as NonModalDialogDisclosurePrimitiveProps,
PopoverArrowProps as NonModalDialogArrowPrimitiveProps,
Expand Down

0 comments on commit ed673f5

Please sign in to comment.