Closed (fixed)
Project:
D7 Media
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
4 Oct 2011 at 10:53 UTC
Updated:
11 Dec 2013 at 01:00 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
pbuyle commentedThe attached patch implements the proposed solution.
Comment #2
bforchhammer commentedOut of curiosity: what happens if the required height out-grows the window-size? (I haven't actually tested the patch yet)
Comment #3
pbuyle commentedThe dialog grows outside the visible area, which activate the browser scrollbar. Note that it also happens without the patch in #1 when you switch to another tab and then come back to the updated one.
Comment #4
idflood commentedThe code looks good and is working well on my tests (changing the exposed filter of the "view library" tab). The patch had a little whitespace error, so here is a simple reroll.
Comment #5
bforchhammer commentedPatch looks good and works as advertised.
Comment #6
jamiecuthill commentedI have a problem even with the above patch in that the resizeIframe call occurs before the images have finished loading. As the images load the iframe also needs to expand. I firstly experimented with a simple interval function that is started (and stopped) with the media browser popup. It worked, however it's not an ideal situation to be checking the iframe height every second when nothing is really happening.
Here are the code snippets I tried in media.popups.js for that though I have a better solution.
Now the better solution is to attach a load event handler on each image within the library view results that will resize the iframe. Patch attached.
Comment #8
jamiecuthill commentedThat might not apply cleanly. Here is a fixed version.
Comment #9
idflood commentedNice catch. I would choose the setInterval option. It's the most reliable method and it will not have much impact on performance.
according to http://api.jquery.com/load-event/
Comment #10
idflood commentedComment #11
jamiecuthill commentedI didn't realise the load event had those issues. Shall I create a patch for the interval implementation?
Comment #12
jamiecuthill commentedHere is the patch for the interval implementation. It's set to resize every second so you will noticed a little lag in the resizing.
Comment #13
jamiecuthill commentedComment #14
idflood commentedThe patch in #12 looks good and and is working well. A little problem is that I was not able to reproduce the issue, even without the patch. So either it has have been fixed somewhere else or I did something wrong.
Comment #15
pbuyle commentedThe patch in #12 launch the interval, whatever the containing page is. So it would probably run the interval twice, once in thepage containing the dialog iFrame, and once in the iFrame itself. The
if ($(context).parents('#media-browser-page').length)in the original patch prevent the resize from running outside the iFrame.Also, even only in the iFrame, resizing every second is not a very good option since resizing is a costly operation. It gets the height of the
bodyelement, triggering a reflow of the document content.Periodic resizing should be limited to the dialog iFrame content and only when it contains images (and maybe frames, iframes, objects and embeds). And even then, if the height has never changed after few resizes, it could probably be assumed that the interval can be cleared.
Comment #16
jarrodirwin commented#8: resize_media_browser-1298962-7.patch queued for re-testing.
Comment #17
jarrodirwin commented#12: resize_media_browser-1298962-8.patch queued for re-testing.
Comment #19
jarrodirwin commentedfixed to work with latest release (unstable5)
Comment #20
pbuyle commentedThe patch does not address my comments in #15.
Comment #21
dddave commentedper #20
Comment #22
dmsmidtI've manually applied the changes as proposed in the patch at # to unstable7-dev.
It works, but I have to agree with #15, that it is a too costly operation.
And browsing images is from an UX point of view not so smooth, since there is a one second lag.
In my patch I set the interval much lower as to get a more smooth transition while the images load.
The interval only starts at the browser tab and stops after all images are loaded.
Also, the resize is only triggered when the body height is taller than the iframe.
The caveats of load() mentioned in #9, are in my implementation imho not that relevant since if load isn't triggered resizing still works and only the interval keeps on running (checking heights).
Comment #23
dmsmidtPatch against unstable7.
Comment #24
ParisLiakos commentedpatch introduces tabs instead of two spaces per drupal codings standards
Comment #25
luksakThis doesn't fix the issue for me. I can't see any improvement.
Comment #25.0
luksaktypo
Comment #26
devin carlson commentedThis should be fixed in the latest -dev as part of #1972628: Browser size doesn't fit it's content.