Restrict width of oEmbeds to max possible width of iframe #1876
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The max width of a sandbox iframe containing embeds is 608px. Nevertheless, the oEmbeds being fetched for the iframe are getting the default width of 660px. The result is:
Note that even with this fix applied, no effect will be noticed because there is also a bug in core that prevents the
maxwidth
param from being passed along to the oEmbed provider. For the fix, which I think will be part of 4.8.1, see https://github.com/xwp/wordpress-develop/pull/239.Also, it feels not right to hard-code the width of
608
especially since the block editing UI is responsive. It would seem preferable to use theoffsetWidth
of the containing element instead to compute this dynamically. Advise on how to best to get this width and to pass it along in the request would be appreciated.Closely related to making videos responsive: #1658.