Make WordPress Core

Opened 6 years ago

Last modified 7 weeks ago

#49030 new defect (bug)

Twenty Twenty: video resize functionality also impacts other elements on the page

Reported by: jeherve's profile jeherve Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 5.3
Component: Bundled Theme Keywords: has-patch dev-feedback
Focuses: javascript Cc:

Description

Twenty Twenty bundles a functionality named "Intrinsic Ratio Embeds", allowing videos (iframe, object, video) to be automatically resized on demand.

This is practical, but can be problematic for some elements on the page that may not behave like a video, or that may not be in the post content at all.

While plugins can use the .intrinsic-ignore CSS class to avoid being impacted by this, I wonder if we could be a bit more specific within the theme, and only target videos inside the post content. This would avoid conflicting with plugins adding iFrames and / or videos outside of the post content, like in widgets.

Attachments (1)

49030.diff (609 bytes) - added by jeherve 6 years ago.
Only target videos inside post content

Download all attachments as: .zip

Change History (10)

@jeherve
6 years ago

Only target videos inside post content

#1 @lancewillett
6 years ago

+1 for limiting the scope of this JavaScript script to only look for objects in post content.

#2 @arcio
6 years ago

Please fix this, not all iframes are videos.

#3 @ianbelanger
6 years ago

  • Focuses javascript added
  • Keywords needs-testing dev-feedback added

This functionality was added in the theme before we decided to add this add_theme_support( 'responsive-embeds' );. It may no longer be needed. I am going to test this to see if we can remove the whole Intrinsic Ratio Embeds function. Other testing would be appreciated. Thanks for bringing this up @jeherve.

#4 @aidvu
6 years ago

+1 to limiting the scope of elements the function looks at.

@ianbelanger what more needs to be done here?

Last edited 6 years ago by aidvu (previous) (diff)

This ticket was mentioned in Slack in #core-themes by karmatosed. View the logs.


2 years ago

#6 @karmatosed
2 years ago

  • Milestone changed from Awaiting Review to Future Release

Moving this to a future release as it has a patch and agreed approach. It now needs testing to check after some time has passed.

This ticket was mentioned in Slack in #core-test by r1k0. View the logs.


3 months ago

#8 @gaisma22
7 weeks ago

Patch Testing Report

Patch Tested: https://core.trac.wordpress.org/attachment/ticket/49030/49030.diff

Environment

  • WordPress: 7.0-beta6-62085-src
  • PHP: 8.3.30
  • Server: nginx/1.29.7
  • Database: MySQL 8.4.8
  • Browser: Brave
  • OS: Ubuntu
  • Theme: Twenty Twenty 3.0
  • MU Plugins: None
  • Plugins: None

Steps taken

  1. Added a Custom HTML widget to footer containing a YouTube iframe with width set to 560px.
  2. Visited the frontend and checked the iframe width via browser console: document.querySelector('.widget iframe').style.width Result before patch: 570px
  3. Applied patch from ticket #49030.
  4. Hard refreshed the frontend and ran the same console command. Result after patch: ''

✅ Patch is solving the problem

Expected result

Twenty Twenty's Intrinsic Ratio Embeds resize function should only target iframes and videos inside post content, not elements in widgets or other areas outside the post content.

Additional Notes

  1. Bug confirmed on WordPress 7.0-beta6 - the resize function was changing the footer widget iframe width from 560px to 570px.
  2. After the patch, the footer widget iframe width is no longer modified by the theme JavaScript.
  3. Original patch path was missing the src/ prefix. Applied after fixing with sed.

Screenshots/Screencast with results

Before Patch:

https://i.ibb.co/QjDm9BfW/before-frontend-footer.png

https://i.ibb.co/prjycqtK/before-console.png

After patch:

https://i.ibb.co/vxnRKt9L/after-console.png

#9 @gaisma22
7 weeks ago

  • Keywords needs-testing removed

Removing needs-testing.
The patch 49030.diff applied cleanly and was confirmed working on WordPress 7.0-beta6.

Note: See TracTickets for help on using tickets.