Modal dialog with `isCentered` has broken overflow
See original GitHub issueDescription
Modal dialog with isCentered
has broken overflow
Link to Reproduction
https://codesandbox.io/s/pensive-wu-6vi25?file=/src/index.js
Steps to reproduce
<Modal isOpen={isOpen} isCentered>
<ModalOverlay />
<ModalContent>
<ModalBody>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
<Text>p</Text>
</ModalBody>
Chakra UI Version
1.6.6
Browser
Google Chrome 94
Operating System
- macOS
- Windows
- Linux
Additional Information
No response
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Twitter Bootstrap Modal window will not stay centered on ...
Curious about an issue that has me sleepless in searching for solution. I am currently opening a Modal Window to collect some data...
Read more >Modal - Bootstrap
Use Bootstrap's JavaScript modal plugin to add dialogs to your site for lightboxes, user notifications, or completely custom content.
Read more >Choppy scrolling in overflow:auto modal dialog when Chrome ...
Issue 429812: Choppy scrolling in overflow:auto modal dialog when Chrome is focused (smooth when unfocused). Reported by schedule ehin.
Read more >Considerations for Styling a Modal | CSS-Tricks
Dealing with Overflow. Now that we're in the business of setting heights, we need to consider overflow. It's tempting to use an overflow...
Read more >scrollable doesn't work on modals with component as content
The default ngb-modal-window .component-host-scrollable rule comes with overflow: hidden , which is not enough if I'm changing modal-body ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I just came across this issue and have the same problem with centered modals.
During my research I found out that the
.chakra-modal__content-container
hasposition: fixed
anddisplay: flex
at the same time. This makes for strange positioning of the child elements when the content overflows.Instead, I would suggest that the
.chakra-modal__content-container
container getsdisplay: block
and the.chakra-modal__content
container gets another wrapper withdisplay: flex
andjustify-content: center
. This allows the browser to position the content correctly. TheModalContent
component would have to change into something like this:I’m curious how a Centered modal with outside overflow would look like. I don’t think this use-case would result in a usable modal.
In my opinion, this is a rare use case, and would recommend using an inside overflow. Really hard to tweak the modal to match every use case out there.
Feel free to modify the components by passing style props to them. When you have a working solution, please post it here and I’ll take a look.
Thanks for understanding.
PS: I’ll update the docs to reflect this opinion