- Notifications
You must be signed in to change notification settings - Fork 4.6k
Description
Description
Most of the time when using the modal component, the modal itself assumes the height of the content.
This isn't the case when the 'fill' size is used (and possibly when isFullScreen is true), in this situation the modal takes up the majority of the page's height.
With the 'fill' size the div that wraps any children still collapses to its content height, so a user of the component can't add children that are set to height: 100%. (at least I wasn't smart enough to find a way to do it, without overriding the modal styles). It's this div that doesn't have a classname that causes the issue:
gutenberg/packages/components/src/modal/index.tsx
Lines 360 to 367 in 9d7efbc
| <div | |
| ref={ useMergeRefs( [ | |
| childrenContainerRef, | |
| focusOnMount === 'firstContentElement' | |
| ? focusOnMountRef | |
| : null, | |
| ] ) } | |
| > |
When fill size is active, it might better for the div in question to have a style like min-height: 100%. This way it's easier for children to be set to 100%, but also they can overflow the content div and become scrollable if needed.
Step-by-step reproduction instructions
- Open the story for modal - https://wordpress.github.io/gutenberg/?path=/story/components-modal--default&args=size:fill
- Using the storybook controls, set the modal height to 'fill'
- Now try setting some of the content in the modal to
100%size, maybe so that the button appears at the bottom of the modal, and observe it's pretty challenging to do.
Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
- Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
- Yes
Please confirm which theme type you used for testing.
- Block
- Classic
- Hybrid (e.g. classic with theme.json)
- Not sure