-
Notifications
You must be signed in to change notification settings - Fork 384
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
Revisit aligned images with inline width larger than max getting displayed off-center #1086
Comments
Hi @westonruter - I've added a user story and ACs here. |
I agree. Let's focus on investigating both the classic and Gutenberg editors to discover the root cause(s) of width and alignment issues.
I ran an experiment on both the classic and Gutenberg editors to find out where the viewport breaks.
Results:
What is the root cause for wider images in Gutenberg? Side-by-Side ComparisonHere's a side-by-side comparison with Gutenberg on the left and the Classic editor on the right: View the example posts: Gutenberg post and Classic Editor post. Box ModelsHTMLThis gist has the HTML for the 580px x 300px image in each editor. Analyzing the ResultsWhy does the Gutenberg image extend outside of the container?The
Essentially, References: MDN | CSS Reference on Codrops with an excellent explanation from Sara Soueidan Possible SolutionIf we wish to contain the images within the content, then we need to change the width from |
Possible SolutionGoing deeper into the discussion above, Gutenberg adds the This means we can add a method into the
If all of those decisions are |
A `<figure>` element with `.wp-block-image` and not `.is-resized` has its width set to a default of `fit-content`. That CSS rule value causes wider images to overflow out of the parent container. For this element, this commit adds an inline style of `width: auto`. Closes #1086.
This seems closely related to #1237, but maybe not. In that ticket, I think the problem is that |
Upon further exploration, the AMP There is a systematic issue in the AMP rendering that appears to be causing the overflow. PR #1281 fixes the rendering; however, it feels more like a bandaid than a solution. For now, this PR is put on hold until we can get an answer back from the AMPHTML project. I've opened a ticket ampproject/amphtml/17084 to capture the issue and its behavior. This issue may be linked to issue #1237 and its open ticket ampproject/amphtml/17053. |
PR #1281 fixes this issue. However, it's a potentially a bandaid. We'll keep this ticket open to track progress on the AMPHTML ticket ampproject/amphtml/17053. Once that ticket is resolved, we can then check for impact or regression issues to our ticket 1086. |
It looks like this isn't yet fixed in ampproject/amphtml#17053. So I'll probably move this issue to 'Ready For Merging' soon if that's alright, as it looks like it will be part of the |
Moving To 'Ready For Merging' This will be part of the RC1 release, as it looks like the underlying issue is not yet fixed in ampproject/amphtml#17053. |
Removing From Milestone If it's alright, I'm removing this from the |
This is being revisited in #2036. Please test. |
…es-redux * 'develop' of github.com:ampproject/amp-wp: Opt-in to amp-img-auto-sizes experiment when there are converted images Remove obsolete add_auto_width_to_figure from #1086 Add test for sizes attribute being removed from converted img Improve aligncenter, alignwide, and alignfull in classic templates Rename method to adjust_twentynineteen_images Eliminate sizes from amp-img converted from img Ensure featured image gets responsive layout in Twenty Nineteen, as it is essentially alignwide Give responsive layout to alignwide/alignfull instead of intrinsic layout Ensure <img> elements converted to <amp-img> which have layout=intrisinc also get object-fit:contain Ensure amp-default style is enqueued before theme's stylesheet Eliminate duplicated CSS by including amp-default.css in classic styles Eliminate handle_centering for images since apparently unnecessary
… amp-story/2058_opacity_range_control * 'amp-stories-redux' of github.com:ampproject/amp-wp: (22 commits) Fix test_enqueue_embed_styling by cleaning up after test_handle_service_worker_iframe_install Change slug too for consistency Change label Convert pt to px. Add Text block style for tip. Try newlines and nl2br Preview style improvements Clear select block upon reorder start Remove unused param. Allow HTML for Text block. Opt-in to amp-img-auto-sizes experiment when there are converted images Remove obsolete add_auto_width_to_figure from #1086 Add test for sizes attribute being removed from converted img Improve aligncenter, alignwide, and alignfull in classic templates Rename method to adjust_twentynineteen_images Eliminate sizes from amp-img converted from img Ensure featured image gets responsive layout in Twenty Nineteen, as it is essentially alignwide Give responsive layout to alignwide/alignfull instead of intrinsic layout Ensure <img> elements converted to <amp-img> which have layout=intrisinc also get object-fit:contain Ensure amp-default style is enqueued before theme's stylesheet ...
… amp-story/1963-call-to-action * 'amp-stories-redux' of github.com:ampproject/amp-wp: Preview style improvements Clear select block upon reorder start Opt-in to amp-img-auto-sizes experiment when there are converted images Remove obsolete add_auto_width_to_figure from #1086 Add test for sizes attribute being removed from converted img Improve aligncenter, alignwide, and alignfull in classic templates Rename method to adjust_twentynineteen_images Eliminate sizes from amp-img converted from img Ensure featured image gets responsive layout in Twenty Nineteen, as it is essentially alignwide Give responsive layout to alignwide/alignfull instead of intrinsic layout Ensure <img> elements converted to <amp-img> which have layout=intrisinc also get object-fit:contain Ensure amp-default style is enqueued before theme's stylesheet Eliminate duplicated CSS by including amp-default.css in classic styles Eliminate handle_centering for images since apparently unnecessary
… amp-story/1998-fix-notice * 'amp-stories-redux' of github.com:ampproject/amp-wp: (22 commits) Fix test_enqueue_embed_styling by cleaning up after test_handle_service_worker_iframe_install Change slug too for consistency Change label Convert pt to px. Add Text block style for tip. Try newlines and nl2br Preview style improvements Clear select block upon reorder start Remove unused param. Allow HTML for Text block. Opt-in to amp-img-auto-sizes experiment when there are converted images Remove obsolete add_auto_width_to_figure from #1086 Add test for sizes attribute being removed from converted img Improve aligncenter, alignwide, and alignfull in classic templates Rename method to adjust_twentynineteen_images Eliminate sizes from amp-img converted from img Ensure featured image gets responsive layout in Twenty Nineteen, as it is essentially alignwide Give responsive layout to alignwide/alignfull instead of intrinsic layout Ensure <img> elements converted to <amp-img> which have layout=intrisinc also get object-fit:contain Ensure amp-default style is enqueued before theme's stylesheet ...
…r-mode * 'develop' of github.com:ampproject/amp-wp: (50 commits) Fix printing of PHP upgrade notice Fix PHP notice for undefined theme support arg for service_worker Remove admin pointer tests that fail in 1.1 Discontinue showing theme support admin pointer in 1.1 Add tests for AMP integration with PWA plugin Ensure is_amp_endpoint() returns false for service worker requests Account for element attributes when determining if a parent is empty and can be removed Fix tests after always including Gutenberg Add check for argument type in add_google_fonts_caching; advise to update to PWA 0.2 Align default-enabled service worker features with ABE SW Remove todo resolved by GoogleChromeLabs/pwa-wp#147 Make AMP service worker opt-out instead of opt-in Opt-in to amp-img-auto-sizes experiment when there are converted images Remove obsolete add_auto_width_to_figure from #1086 Add test for sizes attribute being removed from converted img Improve aligncenter, alignwide, and alignfull in classic templates Rename method to adjust_twentynineteen_images Eliminate sizes from amp-img converted from img Ensure featured image gets responsive layout in Twenty Nineteen, as it is essentially alignwide Give responsive layout to alignwide/alignfull instead of intrinsic layout ...
As a user, I expect my images inside a post to be aligned correctly, even if they are larger than the
max-width
of the given viewport.The conversion of
width
tomax-width
was originally added in #495. This was removed recently in #1064 as it was not determined to be the best solution to the problem reported in #494 (“Aligned images with inline width larger than max get displayed off-center”)? In #610 it was suggested to be removed:It feels like it fixes a symptom but isn't the right solution to the underlying problem.
In #1064 (comment) @mehigh comments:
So we need to (1) replicate the original issue and (2) determine what the best fix is.
The text was updated successfully, but these errors were encountered: