jetpack icon indicating copy to clipboard operation
jetpack copied to clipboard

Comments: iframe is initially too large

Open WillJW opened this issue 11 years ago • 31 comments

Summary of the issue: The Jetpack Comments widget sets too much height on the iframe when it's first loaded. Without guest commenting enabled, it only needs to allow 58px height, but allows 315px, resulting in lots of unnecessary whitespace.

Screenshots:

The initial load of the comment form, with the iframe's <html> element highlighted: image

The widget's code, where the iframe height is being set. See: https://github.com/Automattic/jetpack/blob/master/modules/comments/comments.php#L262 image

WillJW avatar Oct 13 '15 11:10 WillJW

I can't seem to reproduce on my end. Could you post your site URL here, so I can have a look?

If you want it to remain private, you can also contact us via this contact form: http://jetpack.me/contact-support/

jeherve avatar Oct 13 '15 18:10 jeherve

No problem @jeherve, there's a live example here: http://readliverpoolfc.com/2015/10/14/klopps-right-hand-man-arrives-liverpool/

WillJW avatar Oct 14 '15 13:10 WillJW

Thanks. I can see the problem on your site, but can't reproduce on my own sites.

Do you have a copy of that site on a local test environment, where you could try switching to another theme and let me know if the problem persists?

jeherve avatar Oct 14 '15 17:10 jeherve

@jeherve I've just enabled Jetpack Comments on my staging site, and it's fine. The only major difference between the two is that the production site has ads. So I've enabled ad-blocker on the production site, and it's fine! Looks like one of the ad scripts is interrupting it. Do you have any clues about this, or shall I delve deeper myself?

WillJW avatar Oct 14 '15 18:10 WillJW

It might be worth removing each ad, one at a time, until you narrow things down to the one ad that seems to cause the problem.

jeherve avatar Oct 14 '15 18:10 jeherve

Absolutely, I'll try that. Thanks for your help.

WillJW avatar Oct 14 '15 18:10 WillJW

A user reported this in #2531482-t, and I'm able to reproduce it on my test site using Twenty Fifteen/Sixteen.

We set the initial height of the jetpack_remote_comment <iframe> here -

https://github.com/Automattic/jetpack/blob/c447170a842712494948736b54a8f5d0525ba022/modules/comments/comments.php#L286

And then update it here, based on JSON data we receive from WordPress.com -

https://github.com/Automattic/jetpack/blob/c447170a842712494948736b54a8f5d0525ba022/modules/comments/comments.php#L384

On Firefox 44.0/Mac, the <iframe> loads at 315px when logged in, but the JS does not update it -

screen shot 2016-02-09 at 10 33 12 am

When not logged in, it loads at 430px, and the JS correctly updates the the height to 55px -

screen shot 2016-02-09 at 10 33 48 am

On Chrome 48.0.2564.103/Mac, the issue persists whether you're logged in or not. Logged out loads at 430px, and logged in at 315px, but the JS does not set it to 55px in either case.

I cannot replicate this on Safari 9.0.3/Mac at all. The JS correctly resizes the <iframe> whether logged in or not.

Will continue testing and update the ticket with anything else I find.

mahangu avatar Feb 09 '16 05:02 mahangu

Also reported here: https://wordpress.org/support/topic/comments-box-has-set-height-and-no-scroll?replies=1&view=all

jeherve avatar Feb 17 '16 12:02 jeherve

Also reported here: https://wordpress.org/support/topic/huge-white-space-underneath-comment-section-in-chrome?replies=2&view=all

jeherve avatar Feb 25 '16 13:02 jeherve

Also experiencing this.

At Line 389:

if ( <?php echo json_encode( esc_url_raw( $url_origin ) ); ?> !== event.origin ) { return; }

And Line 316 has:

$url_origin = set_url_scheme( 'http://jetpack.wordpress.com' );

In my case $url_origin is correctly set to "http://jetpack.wordpress.com". (I'm not on SSL.)

However event.origin gets set to "https://jetpack.wordpress.com/". Consequently the URLs don't match and the JS that adjusts the height is not run.

Why would Jetpack be requesting its AJAX content over SSL when a site its installed on isn't running under SSL?

cherrybombsoftware avatar Mar 07 '16 23:03 cherrybombsoftware

@cherrybombsoftware That'll be updated in 3.9.3. jetpack.wordpress.com always redirects to https://jetpack.wordpress.com now, so we're going to forego seeing the scheme and always use https.

kraftbj avatar Mar 08 '16 16:03 kraftbj

I'm also experiencing this problem, it seems related to caching somehow... the first time I've accessed it on both on Firefox and Vivaldi (Chromium based) that ugly spacing appeared, and when I open it on a private window it stills happens on both browsers, but it goes away after the first access for the whole private session. On Firefox there's another way to always reproduce the problem: middle-click the link to open in a new tab and let that tab fully load, only switch to it after it's loaded: that problem always happens. My website uses my own child theme based on the popular Zerif theme. I've tried to apply some tricks with css styling but couldn't solve that issue, only with a javascript but it was breaking the other functionality (expand, etc.) so I'm living with that problem :disappointed:. Here's a link: http://alangamedev.com/packing-and-unpacking-bits-faster-than-bitconverter/

Alan-FGR avatar Jul 01 '16 03:07 Alan-FGR

Also reported here: https://wordpress.org/support/topic/jetpack-comments-huge-white-space/#post-9522203

jeherve avatar Sep 25 '17 13:09 jeherve

Even though this issue had a merged fix ( #7831 ) it was never actually closed; good thing, too, but I have another case with Jetpack 5.5:

http://www.psmtickling.com/blog/psm-stands-with-orlando/

Reported here: https://wordpress.org/support/topic/comment-area-size-height/page/2/#post-9676230

So I think this issue still needs a fix.

richardmtl avatar Nov 13 '17 18:11 richardmtl

I have another case with Jetpack 5.5:

Does this happen with one of the default themes as well?

jeherve avatar Nov 13 '17 21:11 jeherve

It does; I've just tried to switch my site to one of the default themes.

The issue seems pretty common on Firefox.

ghost avatar Nov 14 '17 06:11 ghost

The problem is here:

File : wp-content/plugins/jetpack/modules/comments/comments.php Line number 286

change from this: $height = $params['comment_registration'] || is_user_logged_in() ? '315' : '430'; // Iframe can be shorter if we're not allowing guest commenting

to this: $height = $params['comment_registration'] || is_user_logged_in() ? '60' : '430'; // Iframe can be shorter if we're not allowing guest commenting

But this is not total solution, if we update jetpack, the white space height will be back.

dwisetiyadi avatar Nov 14 '17 06:11 dwisetiyadi

I experience the same issue and the solution given by dwisetiyadi dose not work for me.

I even tried to hardcode the height with $height = '60'; or directly changing the iframe code to ... height: 60px; ...

The site seems to simply ignore the code change and keeps presenting me 570px (and yes I checked if FTP upload worked and cleared my cache).

bildschirmfoto 2018-10-22 um 17 50 42

Why is that?

The Number 570px is especially strange because it's nowhere in the whole comments.php file.

Here is the site: https://predicted.blog/multiprocessing-for-kids/

Thanks for your help!

predictedblog avatar Oct 22 '18 15:10 predictedblog

The issue us still persist. I can see large gap below the response box and we cannot edit the plugin.

umeshnevase avatar Nov 27 '18 12:11 umeshnevase

I confirm it also

pawelpotoniec avatar Apr 11 '19 12:04 pawelpotoniec