Opened 6 weeks ago
Last modified 4 weeks ago
#62934 assigned enhancement
WordPress Embedded Block Shows Large Whitespace for Short Posts
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 4.4 |
Component: | Embeds | Keywords: | has-patch dev-feedback close |
Focuses: | Cc: |
Description
On frontend if we have WordPress Embedded block with a post that has less content WordPress Embedded block has large whitespace at the bottom.
Steps to Reproduce
- Create a WordPress post with only a title and no content.
- Create a new post and add a WordPress Embed block.
- Embed the previously created post.
- Save and preview the post on the frontend.
Attachments (1)
Change History (13)
This ticket was mentioned in PR #8286 on WordPress/wordpress-develop by @devansh2002.
6 weeks ago
#1
- Keywords has-patch added
@devansh2002 commented on PR #8286:
6 weeks ago
#2
#3
@
6 weeks ago
- Keywords needs-testing dev-feedback added
Thanks for your report and the PR.
This needs careful testing, as the 200px min height was a deliberate decision at the time.
We don't want to allow the embedded iframe to resize itself to have 0px (and make itself invisible).
Maybe a smaller minimum like 100px is ok, but we should not outright remove the limit.
#4
@
6 weeks ago
@swissspidy
I agree with setting a minimum height.
I tested embedding both short and long content posts.
The embedded iframe height was around 139px, and on mobile (320px width) it was about 161px for short post.
Since, it was less than 200px the iframe was using 200px as height and hence the whitespace.
A minimum height of 100px seems reasonable.
#5
@
5 weeks ago
- Milestone changed from Awaiting Review to 6.8
- Owner set to audrasjb
- Status changed from new to accepted
- Type changed from defect (bug) to enhancement
- Version changed from trunk to 4.4
Introduced in [34903].
If it's only to ensure the embed has a minimal height I would have gone with a smaller value, like 20 or 50px, but 100px looks more that reasonable at a glance, given the fact thats this is probably an edge case.
I tested the patch and the edited PR looks good to me.
#6
@
5 weeks ago
Now I recall why it was 200px minimum height: the sharing dialog needs enough space.
100px is too short, it cuts a lot off.
200px is just enough to display it properly, even when selecting the "HTML Embed" code option. Anything below 200px wouldn't be enough.
We might be able to add some CSS inside the iframe to improve styling if there's not enough space, but we don't control what's inside. So if it's an embed from an older WP version it won't work.
Given the edge case I am inclined to rather close this as a wontfix.
(Reminder, I wrote this code ~10years ago)
#7
@
5 weeks ago
Ahhh yeah I missed the sharing dialog! 😱
That's a big edge case indeed. I agree it's safer to not change this given the wide adoption of embeds…
#8
@
5 weeks ago
The iframe might resize though when opening the sharing dialog, I‘ll need to check that.
#10
@
5 weeks ago
- Keywords needs-testing removed
The iframe might resize though when opening the sharing dialog, I‘ll need to check that.
Nope, it doesn't.
That would be an interesting thing to add, but requires a bigger change to the embed-template.js file. Then the behavior would be like in the video I just added.
But even with such a change we can't just drop the minimum right away, because you might be embedding a post from an older WordPress site without the embed-template change.
So leaning towards wontfix or maybelater.
Fix embed block height calculation by removing unnecessary lower bound check.
Issue: On frontend if we have WordPress Embedded block with a post that has less content WordPress Embedded block has large whitespace at the bottom.
Trac ticket: https://core.trac.wordpress.org/ticket/62934