-
Notifications
You must be signed in to change notification settings - Fork 165
Fix sizes
attribute for regular aligned body images.
#701
Conversation
… for `alignwide` and `alignfull` images, but is an improvement over core.
Thanks, @mor10. In general, this seems like a sound change, and the values you added match up with the expected widths for non-wide/full images. 👍 What's the best way to test this? I can see that the |
@kjellr Easiest way to test:
Yes, this is a total pain to test, which is why it's often overlooked. To test you have to force the browser to make visible what it very much wants to keep hidden. |
For the record, the output code here is identical to the output code in this demo, which has graphic size displays for easier reference: https://gutenberg.mor10.com/responsive-images-demo-corrected-code/ Same procedure as above applies for testing. |
Thank you! Those instructions are very helpful. I tested this out, and I can see that the browser is now pulling in different image sizes than before. Testing with a Default:
With this PR:
For non-aligned images, this looks great. But unfortunately Current: This PR: In the case of Twenty Seventeen, a custom setting for that Edit: I'll also note that the demo you shared above doesn't seem to have this issue, so I'm not sure what's different there. |
@kjellr What you're seeing with wide and full images is the exact problem I've flagged in various tickets and PRs in Twenty Nineteen (#50), Gutenberg (issue 6177), and WordPress Core (trac ticket 45407). The solution sits in #629. The demo I shared above has proper |
Yes, I see that. I meant to convey that until a solution to that problem is sorted out, this PR should probably be put on hold — since it has a negative impact on the appearance of alignfull/alignwide images. |
This PR has been ported over to Trac as a patch on this ticket: https://core.trac.wordpress.org/ticket/45985 |
This PR fixes the incorrect
sizes
attribute for regular aligned body images. It does not solve foralignwide
andalignfull
images, but is an improvement over core. While we wait for thewp_calculate_image_sizes
filter to be updated at some later date, this PR should be merged with core before 5.0 release to avoid even regularly aligned images receiving an incorrectsizes
attribute.This PR follows the same pattern as what is already in previous default themes including Twenty Seventeen: https://github.com/WordPress/WordPress/blob/master/wp-content/themes/twentyseventeen/functions.php#L491-L517
@kjellr I strongly recommend this be merged before 5.0 release.