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

Update detectElementResize to support rendering into iframes and child windows #900

Merged
merged 2 commits into from
Jan 6, 2018

Conversation

ahutchings
Copy link
Contributor

@ahutchings ahutchings commented Dec 13, 2017

Without these changes, the size of elements rendered in remote windows is incorrectly detected as height 0/width 0.

  • Create detectElementResize CSS in the document containing the rendered AutoSizer.
  • Create the resize trigger element using the document containing the rendered AutoSizer.

I'm not sure how to go about testing for this change - any suggestions are welcome.

@bvaughn
Copy link
Owner

bvaughn commented Dec 17, 2017

Can you point me at an example of the type of thing you're trying to do that this change enables? A Codesandbox demo would be great!

…rget

* Create detectElementResize CSS in the window containing the rendered AutoSizer.
* Create the resize trigger element using the document containing the rendered AutoSizer.
@ahutchings
Copy link
Contributor Author

ahutchings commented Dec 22, 2017

Sure, I created a Codesandbox here: https://codesandbox.io/s/nro7yzrqv0.

Two popup windows are opened -

  • The one with the red square is using the unpatched version of react-virtualized, so the detectElementResize CSS is not appended to its document tag, and so the square does not resize.
  • The one with the green square is using the changes in this PR, which append the detectElementResize CSS to the owning document of the AutoSizer's parent node.

I also updated the PR to remove some changes to AutoSizer that turned out to be unnecessary.

@ahutchings ahutchings changed the title Update AutoSizer to support using a remote window as portal render target Update detectElementResize to support using a remote window as portal render target Dec 22, 2017
@ahutchings ahutchings changed the title Update detectElementResize to support using a remote window as portal render target Update detectElementResize to support rendering into iframes and child windows Dec 22, 2017
@bvaughn
Copy link
Owner

bvaughn commented Dec 22, 2017

Both pop-up windows appear to resize the same for me. (Although neither shows the background color correctly. I have to inspect the HTML manually and watch it being updated.)

@ahutchings
Copy link
Contributor Author

Oops, turns out some of those changes are needed for Chrome, but not for Firefox. Working on adding them back now.

@ahutchings
Copy link
Contributor Author

Pushed a new commit and updated the Codesandbox. It now works properly in both Chrome and Firefox.

Copy link
Owner

@bvaughn bvaughn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for updating the CodeSandbox. Sorry it has taken me so long to circle back here. I've been busy. 😄

I think this looks okay, although I haven't messed around with portals in popup windows before so I don't have any direct experience.

I've tested your change locally and verified that it doesn't seem to cause any regressions. So let's roll with it. 👍

@bvaughn bvaughn merged commit 1fb6308 into bvaughn:master Jan 6, 2018
bvaughn added a commit that referenced this pull request Jan 6, 2018
@TrySound
Copy link
Contributor

TrySound commented Jan 6, 2018

@bvaughn Is it possible to cover it with puppeteer tests?

@bvaughn
Copy link
Owner

bvaughn commented Jan 6, 2018

I dunno. Maybe?

@TrySound
Copy link
Contributor

TrySound commented Jan 6, 2018

@ahutchings Would you like to take care about test for this case?

@ahutchings ahutchings deleted the feature/portal-support branch January 7, 2018 15:49
@ahutchings
Copy link
Contributor Author

Sure, I will take a look at creating a test case for this. Looks like I can use the WindowScroller end-to-end test as an example.

@bvaughn
Copy link
Owner

bvaughn commented Jan 7, 2018

Nice! Thanks!

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.

3 participants