question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add ability to specify Modal parent

See original GitHub issue

Issue 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:closed
  • Created 6 years ago
  • Comments:16 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
supergibbscommented, Feb 26, 2018

@leebradley That is a cool use case but can it be done with bootstrap CSS? The goal of reactstrap is to make bootstrap easy to use with react by creating components that apply the correct class names and replacing the jquery library with react. Since bootstrap only supports full page modals, this is out of scope for reactstrap.

@tannerhallman Hopefully soon! @TheSharpieOne manages the releases.

1reaction
ameliabradleycommented, Feb 26, 2018

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found