-
Notifications
You must be signed in to change notification settings - Fork 139
Hide post embed iframes with visibility:hidden instead of clipping #1192
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
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
As per my comment on the issue, this also needs to be tested with an iframe containing an image (post thumbnail) to ensure that is loading as expected too. |
|
@swissspidy oh, got it. Here's a test page: https://retractable-crane-47a33d.instawp.xyz/pascal-birchler-on-democratizing-performance/ ✅ Behavior in Chrome 123 on ChromeOS: Screen.recording.2024-05-01.14.44.11.webm |
|
✅ Behavior in Safari 17.4.1 on macOS 14.4.1: Screen.Recording.2024-05-01.at.14.48.42.mov |
|
✅ Behavior in Firefox 124.0.2 on macOS 14.4.1: Screen.Recording.2024-05-01.at.14.53.45.mov |
This comment was marked as outdated.
This comment was marked as outdated.
|
Actually, I can't confirm whether Local Overrides were working correctly when I did that test in #1192 (comment). So I've copied the post content and put it on a test site: https://retractable-crane-47a33d.instawp.xyz/wordpress-6-4-field-guide/
LCP is reduced from 438.5 ms to 411.9 ms so a 6% improvement, at least for this single run. |
|
I've opened WordPress/wordpress-develop#6474 to apply this patch to core as well: https://core.trac.wordpress.org/ticket/58773#comment:26 |
adamsilverstein
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great!
|
After discussing with @joedolson, he also suggested It seems going with Finally, I just discovered that |


Summary
Fixes #1114
Relevant technical choices
When a lazy-loaded
iframeis styled withclip: rect(1px, 1px, 1px, 1px), it seems Chrome does not reliably load it. Interestingly, the iframe loads when navigating to the page from another page, but it does not load when doing an iframe.If the
clipis replaced withvisibility:hidden(or other options per #1192 (comment)) then it does load reliably. This also fixes an accessibility problem whereby if a post embed iframe does not get displayed (such as due to JavaScript being disabled), when the iframe is hidden withclipthen the user can still tab through links in the iframe which is confusing since the links are not shown (for sighted users); whenvisibility:hiddenis used, then content is skipped from being navigated until it is made visible.Before
Screen.recording.2024-04-30.12.22.47.webm
After
Screen.recording.2024-04-30.12.23.41.webm