Skip to content
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

window.open - mount the Popup to the relevant document.body #4219

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

glaukon-ariston
Copy link

When you open a new window with window.open and try to open a Popup there, the Popup gets shown at the correct position but in the wrong window. The culprit is this line in the PortalInner.js where document.body of the initial window gets assigned to the mountNode property which is then passed to ReactDOM.createPortal.

I have made the change in Popup.js so that the correct mountNode gets extracted from the Popup's referenceElement (either context or trigger) through the DOM's .ownerDocument property.

The fix also needs to be made for Modal (use trigger's .ownerDocument if mountNode is not provided), Dimmer and TransitionablePortal components that all use Portal component.

For an example of using window.open with React see Using a React 16 Portal to do something cool and Popout Windows in React.

@welcome
Copy link

welcome bot commented Jun 25, 2021

💖 Thanks for opening this pull request! 💖

Here is a list of things that will help get it across the finish line:

  • Run yarn lint locally to catch formatting errors. This will fix some errors automatically, commit and push any changes.
  • Run yarn test locally to catch errors. This ensures all components still behave as they should.
  • Run yarn start to run the doc site locally and try a few pages, ensuring everything is in good working order.
  • Include tests when adding/changing behavior.

We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can.

@codecov-commenter
Copy link

codecov-commenter commented Jun 25, 2021

Codecov Report

Merging #4219 (210667e) into master (bb2db59) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #4219   +/-   ##
=======================================
  Coverage   99.75%   99.75%           
=======================================
  Files         180      180           
  Lines        3241     3242    +1     
=======================================
+ Hits         3233     3234    +1     
  Misses          8        8           
Impacted Files Coverage Δ
src/modules/Popup/Popup.js 98.91% <100.00%> (+0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ff70355...210667e. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants