From 7cfbd7b0918b9c4d2c5cd522d157d778badedab5 Mon Sep 17 00:00:00 2001 From: Peter Kulko Date: Mon, 11 Nov 2024 14:38:50 +0200 Subject: [PATCH] feat: Removed default value for isOverflowVisible in ModalDialog component --- src/Modal/ModalDialog.jsx | 10 ++- src/Modal/modal-dialog.mdx | 101 +++++++++++++++++++++++++-- src/Modal/tests/ModalDialog.test.jsx | 2 + 3 files changed, 104 insertions(+), 9 deletions(-) diff --git a/src/Modal/ModalDialog.jsx b/src/Modal/ModalDialog.jsx index 6814b3c22e..caa519c1c6 100644 --- a/src/Modal/ModalDialog.jsx +++ b/src/Modal/ModalDialog.jsx @@ -122,8 +122,13 @@ ModalDialog.propTypes = { * Specifies the z-index of the modal */ zIndex: PropTypes.number, - /** Specifies whether overflow is visible in the modal */ - isOverflowVisible: PropTypes.bool, + /** + * Specifies whether overflow content inside the modal should be visible. + * - `true` - content that exceeds the modal boundaries will remain visible outside the modal's main viewport, + * rather than being clipped or hidden. + * - `false` - any overflow content will be clipped to fit within the modal's dimensions. + */ + isOverflowVisible: PropTypes.bool.isRequired, }; ModalDialog.defaultProps = { @@ -137,7 +142,6 @@ ModalDialog.defaultProps = { isFullscreenOnMobile: false, isBlocking: false, zIndex: undefined, - isOverflowVisible: true, }; ModalDialog.Header = ModalDialogHeader; diff --git a/src/Modal/modal-dialog.mdx b/src/Modal/modal-dialog.mdx index 7e2ad4b153..bfc0f84b0b 100644 --- a/src/Modal/modal-dialog.mdx +++ b/src/Modal/modal-dialog.mdx @@ -31,10 +31,13 @@ label for the dialog element. const variants = ['default', 'warning', 'danger', 'success', 'dark']; const [modalSize, setModalSize] = useState('md'); const [modalVariant, setModalVariant] = useState('default'); + return ( <>
- +
@@ -73,7 +77,11 @@ label for the dialog element.

- I'm baby palo santo ugh celiac fashion axe. La croix lo-fi venmo whatever. Beard man braid migas single-origin coffee forage ramps. Tumeric messenger bag bicycle rights wayfarers, try-hard cronut blue bottle health goth. Sriracha tumblr cardigan, cloud bread succulents tumeric copper mug marfa semiotics woke next level organic roof party +1 try-hard. + I'm baby palo santo ugh celiac fashion axe. La croix lo-fi venmo whatever. + Beard man braid migas single-origin coffee forage ramps. Tumeric messenger + bag bicycle rights wayfarers, try-hard cronut blue bottle health goth. + Sriracha tumblr cardigan, cloud bread succulents tumeric copper mug marfa + semiotics woke next level organic roof party +1 try-hard.

@@ -82,7 +90,7 @@ label for the dialog element. Cancel - @@ -102,10 +110,13 @@ label for the dialog element. const variants = ['default', 'warning', 'danger', 'success', 'dark']; const [modalSize, setModalSize] = useState('md'); const [modalVariant, setModalVariant] = useState('dark'); + return ( <>
- +

- I'm baby palo santo ugh celiac fashion axe. La croix lo-fi venmo whatever. Beard man braid migas single-origin coffee forage ramps. Tumeric messenger bag bicycle rights wayfarers, try-hard cronut blue bottle health goth. Sriracha tumblr cardigan, cloud bread succulents tumeric copper mug marfa semiotics woke next level organic roof party +1 try-hard. + I'm baby palo santo ugh celiac fashion axe. La croix lo-fi venmo whatever. + Beard man braid migas single-origin coffee forage ramps. Tumeric messenger + bag bicycle rights wayfarers, try-hard cronut blue bottle health goth. + Sriracha tumblr cardigan, cloud bread succulents tumeric copper mug marfa + semiotics woke next level organic roof party +1 try-hard.

@@ -153,7 +169,80 @@ label for the dialog element. Cancel - + + +
+ + ) +} +``` + +## Overflow visibility handling + +The `isOverflowVisible` toggle controls whether content that extends beyond the modal's viewport boundaries is visible. +When enabled (`isOverflowVisible` is set to `true`), any overflow content, such as dropdowns or tooltips, +will be displayed outside the modal's main area instead of being clipped. + +In this example, switching `isOverflowVisible` on and off affects the visibility of the dropdown options in +the autosuggest field, showing how overflow handling impacts content display within a modal. + +```jsx live +() => { + const [isOpen, open, close] = useToggle(false); + const [isOn, setOn, setOff, toggle] = useToggle(false); + + return ( + <> +
+ +
+ + + + I'm a dialog box + + + + + + + isOverflowVisible + + {isOn + ? {JSON.stringify(isOn)} + : {JSON.stringify(isOn)} + } + + + JavaScript + Python + Ruby + C + + + + + + + Cancel + + diff --git a/src/Modal/tests/ModalDialog.test.jsx b/src/Modal/tests/ModalDialog.test.jsx index 6ca06dbdcc..790e162c90 100644 --- a/src/Modal/tests/ModalDialog.test.jsx +++ b/src/Modal/tests/ModalDialog.test.jsx @@ -24,6 +24,7 @@ describe('ModalDialog', () => { size="md" variant="default" hasCloseButton + isOverflowVisible > The title @@ -58,6 +59,7 @@ describe('ModalDialog with Hero', () => { size="md" variant="default" hasCloseButton + isOverflowVisible >