diff --git a/.changeset/silly-buses-prove.md b/.changeset/silly-buses-prove.md new file mode 100644 index 00000000..4a592fb2 --- /dev/null +++ b/.changeset/silly-buses-prove.md @@ -0,0 +1,5 @@ +--- +"@telegraph/modal": patch +--- + +fix modal overflow issue diff --git a/packages/modal/src/Modal/Modal.stories.tsx b/packages/modal/src/Modal/Modal.stories.tsx index 054aa0e5..9c6d5723 100644 --- a/packages/modal/src/Modal/Modal.stories.tsx +++ b/packages/modal/src/Modal/Modal.stories.tsx @@ -63,6 +63,134 @@ export const Modal: Story = { }, }; +export const ScrollingModal: Story = { + render: () => { + // eslint-disable-next-line react-hooks/rules-of-hooks + const [open, setOpen] = React.useState(true); + const Modal = TelegraphModal; + return ( + <> + + + + + + Modal title + + + + +

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+

Modal body

+
+ + + + +
+
+ + ); + }, +}; + type NestedModalProps = { open: boolean; onOpenChange: (value: boolean) => void; diff --git a/packages/modal/src/Modal/Modal.tsx b/packages/modal/src/Modal/Modal.tsx index 9d78182c..a8782438 100755 --- a/packages/modal/src/Modal/Modal.tsx +++ b/packages/modal/src/Modal/Modal.tsx @@ -3,7 +3,7 @@ import { FocusScope } from "@radix-ui/react-focus-scope"; import { useControllableState } from "@radix-ui/react-use-controllable-state"; import * as VisuallyHidden from "@radix-ui/react-visually-hidden"; import { Button } from "@telegraph/button"; -import type { Required } from "@telegraph/helpers"; +import { RefToTgphRef, type Required } from "@telegraph/helpers"; import type { PolymorphicProps, TgphComponentProps, @@ -201,12 +201,14 @@ type ContentRef = React.ElementRef; const Content = React.forwardRef( ({ children, ...props }, forwardedRef) => { return ( - - - - {children} - - + + + + + {children} + + + ); }, @@ -234,9 +236,22 @@ const Close = ({ type BodyProps = PolymorphicProps & TgphComponentProps; -const Body = ({ children, ...props }: BodyProps) => { +const Body = ({ + style, + children, + ...props +}: BodyProps) => { return ( - + {children} );