-
Notifications
You must be signed in to change notification settings - Fork 47.1k
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
Iframe's reinitialise when moving down within a group of components #858
Comments
I can't see anything wrong with your code from a 2 min inspection. You are properly using key and the reconciliation should work fine. cc @jordwalke |
Curious. I'll take a look later. |
Up/Down asymmetry may be related to this (ok by itself): https://github.com/facebook/react/blob/338ce60/src/core/ReactMultiChild.js#L336-L343 |
|
You might think that you could just call |
Yeah, just did some manual tests as well, this actually appears to be impossible to workaround in the DOM, and some internet searching suggests the same. The only universal solution I see is to somehow be able to mark a component as However, I'm curious how much of an issue this actually is today? Does this make iframe in React virtually pointless because of conditionals further up in parents, or is it really only an issue when explicitly moving components with iframes around? |
This is one of the most regrettable misfeatures of |
To prevent reloading of |
@plievone Yeah, but the only way to keep them perfectly in sync would be to poll every frame, and this would cause lag on IE8 as it doesn't support |
@spicyj @benjamn I had a look at React and it is possible to solve this as good as it gets (i.e. an iframe may never move to the other side of another iframe) by applying a Been trying to wrap my head around |
Just for reference i got an implementation going as @plievone suggested by absolute positioning the iframe into place, http://jsfiddle.net/pieterv/fnkLf/6/, but as expected it seems to be pretty fragile code, you would really need to have the siblings as set height elements to get away with not polling their position on every frame. |
@pieter-vanderwerff FYI, I have a proof-of-concept for a React PR working right now, just fixing the last issues. With it, iframes will work as they should as long as two iframe containing components never switch sides. Meaning, it should basically solve most common use-cases, except for moving say comments with iframes up/down in a list, but static iframes and blog style pages will work perfectly. It seems like it's a relatively light-weight fix too so hopefully they accept it. |
@syranide awesome, i look forward to seeing it! |
@pieter-vanderwerff I dare you to check my updated PR, I found something way way better than attributes to use! :D |
Would using CSS Flexbox's |
@pixelcort Probably not, the issue is specifically when they (or any of their ancestores) are detached from the DOM, which always happens if you try to move them in any way it seems. |
This effectively removes the requirement of providing a fixed root container for React.render to use!
I have a related issue with iframes which needs a different fix. I have a component using the Twitter API to embed a tweet in So the problem here is that the component has no way of knowing that this just happened. There is no lifecycle method telling it about the DOM manipulation (sth. like Edit: I found a workaround for my particular use-case to at least have a chance to reload the tweet. The iframe will fire an |
I was able to find some success in using Flexbox's More a hack than a general solution really, but seems to be working well enough for my purposes. The trick being that in the "After" example, the order of elements in the DOM never truly changes, just visually reordered with the |
5.4.1. Reordering and Accessibility |
This problem is both rare and hard enough that it is unlikely we’ll be spending our time on this. The complexity and increase in the code size this will introduce is probably not worth the effort. I’m open to reviving it if somebody comes up with a simple solution to this, but I just don’t see it. |
18.07.2022 this issue still here |
When moving a component with an iframe down within a group of components it reinitialises the iframe. The iframe only reinitialises when moving down, moving upward seems to work fine.
Example: http://jsfiddle.net/pieterv/fnkLf/
The text was updated successfully, but these errors were encountered: