-
-
Notifications
You must be signed in to change notification settings - Fork 981
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
The size of an iframe keeps increasing when using vh units for elements inside the iframe #1062
Comments
If you find a fix for this, I would welcome a PR |
@davidjbradshaw I'm thinking about making a PR, but I'm not sure if you like this approach:
|
What would happen if the user resizes the browser window? |
Not sure if it's possible but ideally it would recalculate on resize. Maybe it should add every element that is 'fixed' to an array with it's original vh. On resize loop over the elements and recalculate? |
I like @Paulsky's idea. Would love to see what that may look like, and here for the discussion. I've been struggling with the same issue on a similar implementation (my own code, not this repo). I'm loading in 3rd party code with vh and svh units in the CSS. Finding and replacing them feels like a heavy lift, with some serious performance implications, especially if you want to update on window resize. Consider CSS like If OP (probably long gone) has control over the src doc I would update the CSS to somewhat match their goal (tricky), or use JS to access |
I'm happy to look at a PR, but I fear it will be tricky to make it work reliably. I'm also concerned about the performance impact. Currently I have a performance target of under 1ms to make all the size calculations. |
btw the upcoming V5 #1212 release will automatically remove |
Thinking a bit more the easiest solution might be to create an array of I might add |
I'm seeing issues with resizing when the user changes the zoom level on the browser. Could this be related? |
@EvanBoyle maybe, it really depends on the CSS in your iframe. Do you have issues with an unstyled page in the iframe? If so I think that is a new ticket. |
Unfortunately, I currently don't have the time to create a PR. Maybe I'll be able to contribute in the near future. |
Having looked into this, any possible fix would require inspecting the computed CSS for every element on the page and my test show that running that on this page would take around 20 seconds to process. So is just not practical to implement. Instead I will add a page the website on iframe content guidelines that explains why you don’t actually need |
Describe the bug
I have a page I need to embed with iframe. This page has a hero picture that takes up entire viewport (100vw and 100vh) plus the rest of the content that is dynamic and therefore changes it's height. The 100vw value behaves fine, however, 100vh break the page with embedded iframe. Namely, the height of the page endlessly while zooming in the picture. I saw that previous issues recommended removing unnecessary vh and % units, but in my case they are necessary.
To Reproduce
Set height of a section on the child page to 100vh
Expected behavior
I would expect vh units work inside the iframe since this is now so popular and widely used.
Desktop (please complete the following information):
I have seen the same behavior in Chrome and Firefox
The text was updated successfully, but these errors were encountered: