-
Notifications
You must be signed in to change notification settings - Fork 208
Add ability to render popup in different root element using portal #47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
3e81477
to
9e02076
Compare
@yjose thoughts on this? |
Hi @dhruvparmar372, Sorry for my late. |
Hi @yjose! Thanks for creating this awesome package! Can you explain why injecting HTML outside app root is a bad idea? As far as I understand because of nature how stacking contexts work in browser (they are not global but hierarchical) this is the only solution. For example let's assume you want to have a popup for a text having ellipsis. For that you need to add Other example would be having a scrollable list of items. Let's assume we want to have a popup for every item in the list. As we add Another example is that even if we give What do you think? I am thinking about creating some similar package incorporating React's |
The above solution makes rendering the popup to a portal optional, if you don't pass in An alternative approach might be to allow to wrap the app root itself with a HOC, something like this
The HOC could be exposed as a function by the package and Whichever approach is taken, I feel it's necessary for the library to allow rendering a popup in an element which is not contained in the app's root element. |
@dhruvparmar372 I am not seeing any mention of the popupRootID in any of the documentation. I am trying to get the modal to open on the very top level of my site. I have the Popup rendering on a table cell, and when the modal opens, it currently only opens within the confines of the table. |
@CodeHutDevelopment you can check the PR diff for the usage, https://github.com/yjose/reactjs-popup/pull/47/files#diff-66a12f065041e1923969613bdddd5d10R28 |
@dhruvparmar372 Ok, found that, so I added it to my code:
When I look at the react code in Developer, I am seeing the popupRootID in props and the modal is still rendering inside the DataTable instead of the tag (tag with id="top") |
can these be released soon? what is missing for a merge and a new version release |
Hi, I also need this function. Can you release it? |
Hey! |
9e02076
to
0a6ad70
Compare
Guys, can you fix it? |
agreed this will be a very useful property |
@dhruvparmar372 did you by any chance publish a fork of this package that includes this PR? |
const portalRoot = document.getElementById(this.props.popupRootID); | ||
const portal = portalRoot | ||
? [ | ||
ReactDOM.createPortal( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is using global ReactDOM, which is unlikely to be present. Must import ReactDOM
.
I have published this package as You can @yjose As a curtesy to contributors, it is nice to either close the PR and say you are not going to merge it, provide feedback what is required for PR to get merged, or merge the PR. It discourages community participation if PRs don't get merged and remain hanging literally for over a year. |
@yjose Any chance of releasing this? I've now used this in at least 3 projects. |
@yjose why not publish this? Why just close it without comment? It's a shame to have to choose between a version that has custom portaling and a version that's still receiving updates. The built-in portal seems to mangle our layout. I get the impression this library is unmaintained because of the handling of this issue, and indeed, the last merged PR is nearing a year old now. |
Fixes #46