Add ability to specify Modal parent
See original GitHub issueIssue description
- components:
Modal
- reactstrap version
5.0.0-beta
- react version
16.3.0
- bootstrap version
4.0.0
What is happening?
There is currently no way to specify a Modal container. All Modals appear as children of the body.
What should be happening?
Modal should provide a parentSelector
prop, similar to the one in the react-modal library.
See: http://reactcommunity.org/react-modal/#usage
/*
Function that will be called to get the parent element that the modal will be attached to.
*/
parentSelector={() => document.body}
This should be a relatively minor feature. I’d be happy to implement and create a pull request myself (although that’s not necessary.)
I’m creating this issue mostly to test the water and get feedback from the reactstrap devs.
Issue Analytics
- State:
- Created 6 years ago
- Comments:16 (4 by maintainers)
Top Results From Across the Web
Set the attribute of a parent element in pure CSS
Set the attribute of a parent element in pure CSS · 1 · Can you add a class to the modal you are...
Read more >How to create an accessible React modal | by Seif Ghezala
To show/hide the modal, we simply render it conditionally based on the isModalVisible boolean. When we click on the open modal button, we...
Read more >Create a Popup Modal in React (with parent and ... - YouTube
Learn how to create a popup modal in React. Many tutorials create modals in the parent component, but in this tutorial I will...
Read more >Considerations for Styling a Modal | CSS-Tricks
It's easier to position the modal when you're dealing with the page-covering body rather than an unknown set of parent elements, ...
Read more >How to pass data into a bootstrap modal? - GeeksforGeeks
A modal is a popup or dialog box that requires some action to be performed. A modal. Bootstrap has inbuilt modal component.
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 Free
Top 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
@leebradley That is a cool use case but can it be done with
bootstrap
CSS? The goal ofreactstrap
is to makebootstrap
easy to use withreact
by creating components that apply the correct class names and replacing thejquery
library withreact
. Sincebootstrap
only supports full page modals, this is out of scope forreactstrap
.@tannerhallman Hopefully soon! @TheSharpieOne manages the releases.
@supergibbs That’s a good point. It’s not supported in vanilla Bootstrap 4. I didn’t realize that Bootstrap fixed-positioned the modal element by default, but I guess that makes sense.