You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Either during DOM initialization — the element starts with dimensions guessed from its CSS width plus the assumed fallback aspect ratio of a video (e.g. in Safari this seems to be 2:1).
Or if the video uses preload = none, also after the DOM is ready, it has this provisional dimensions and as soon as the user clicks PLAY, and the browser starts fetching the video and determines its width/height, then layout shift occurs.
Expected
When you insert a video block and set/change the source,
… the Block Editor gets the image dimensions from:
b. ❌ The Media Library — Tested: Creates no width/height attributes.
c. ❓ Externally hosted video file — Did not test this yet — By an API which returns the video dimensions by loading the video's first few bytes (moov atom at the start) or the last bytes (metadata at the end)
… and inserts the width and height parameters into the video element accordingly:
Independent from the block dimension or alignment settings ( None, Wide, Full Width). Like with the Image block with its own dimensions and the underlying img element with its src, width, height.
Prioritization: I assume CLS optimization is a goal of WordPress.
I assume this is not a SEO luxury only.
But a real usability problem (especially when having multiple videos (with aspect ratios quite different than the assumed fallback)) — Then viewport shifting is noticeable to even disturbing.
WordPress Classic: Does it create video elements with width and height?
I never used Classic, and do not plan to set it up.
If someone knows please comment.
I guess what I describe under "expected" steps 2abc probably all need certain WordPress Core API calls.
Please tell whether such functions exists or not in comments below.
Please file corresponding ticket(s) in WP Core to provide the necessary function(s).
The text was updated successfully, but these errors were encountered:
Reproduction
Actual
<video>
element does not have the attributeswidth
andheight
.preload = none
, also after the DOM is ready, it has this provisional dimensions and as soon as the user clicks PLAY, and the browser starts fetching the video and determines its width/height, then layout shift occurs.Expected
width
andheight
parameters into the video element accordingly:img
element with itssrc
,width
,height
.Environment
Infos to be amended by experts please
video
elements withwidth
andheight
?The text was updated successfully, but these errors were encountered: