Make WordPress Core

Opened 6 months ago

Closed 3 months ago

Last modified 4 days ago

#62597 closed defect (bug) (fixed)

WordPress 6.7 sizes="auto" is messing featured image on chrome mobile.

Reported by: maciejmackowiak's profile maciejmackowiak Owned by: joemcgill's profile joemcgill
Milestone: 6.7.2 Priority: normal
Severity: normal Version: 6.7
Component: Post Thumbnails Keywords: has-patch has-test-info has-screenshots fixed-major dev-reviewed
Focuses: ui, css, administration Cc:

Description

WordPress 6.7 added sizes=”auto” for some images.
In wp-admin on chrome when we have the classic editor plugin active the featured image is "squashed".
This seems to be the issues with css rule height: auto for #postimagediv .inside img which cannot be simply overriden, it needs to be deleted to fix the issue.

The easiest way to reproduce is to set featured image to any square image.

https://i.postimg.cc/4457NnhX/obraz.png
https://i.postimg.cc/TPgh8P6M/obraz.png

Change History (20)

#1 @sainathpoojary
6 months ago

Reproduction Report

Description

This report validates whether the issue can be reproduced.

Environment

  • WordPress: 6.7.1
  • PHP: 8.1.29
  • Server: nginx/1.16.0
  • Database: mysqli (Server: 8.0.16 / Client: mysqlnd 8.1.29)
  • Browser: Chrome 131.0.0.0
  • OS: macOS
  • Theme: Twenty Twenty-Five 1.0
  • MU Plugins: None activated
  • Plugins:
    • Classic Editor 1.6.6
    • Test Reports 1.2.0

Actual Results

  1. ✅ Error condition occurs.

Supplemental Artifacts

https://utfs.io/f/PL8E4NiPUWyOosOW6eVgRVfkrM3cxj5whHLEvyNZCb2PpWuo

This ticket was mentioned in PR #7910 on WordPress/wordpress-develop by @sainathpoojary.


6 months ago
#2

  • Keywords has-patch added

Remove height: auto from #postimagediv .inside img to prevent distortion of featured images in the Classic Editor.

Trac ticket: #62597

#3 @abcd95
6 months ago

  • Keywords has-testing-info has-screenshots added

Test Report

Description

This report validates that the indicated patch works as expected.

Environment

  • WordPress: 6.7.1
  • PHP: 8.1.29
  • Server: nginx/1.16.0
  • Database: mysqli (Server: 8.0.16 / Client: mysqlnd 8.1.29)
  • Browser: Chrome 131.0.0.0
  • OS: macOS
  • Theme: Twenty Twenty-Five 1.0
  • Plugins:
    • Classic Editor 1.6.6

Actual Results

✅ Issue resolved with patch.

Supplemental Artifacts

Screenshot - https://postimg.cc/62kDGbkG

#4 @sukhendu2002
6 months ago

Test Report

Description

This report validates whether the indicated patch works as expected.

Patch tested: https://github.com/WordPress/wordpress-develop/pull/7910

Environment

  • WordPress: 6.8-alpha-59274-src
  • PHP: 8.2.26
  • Server: nginx/1.27.3
  • Database: mysqli (Server: 8.0.40 / Client: mysqlnd 8.2.26)
  • Browser: Chrome 131.0.0.0
  • OS: macOS
  • Theme: Twenty Twenty-Five 1.0
  • MU Plugins: None activated
  • Plugins:
    • Classic Editor 1.6.6
    • Test Reports 1.2.0

Actual Results

  1. ✅ Issue resolved with patch.

Supplemental Artifacts

Before

https://utfs.io/f/TTyF6MLuAyHDeFFbRaerQjuAYVHZvEhTSDrJIM8mRCfKXya7

After

https://utfs.io/f/TTyF6MLuAyHDfX4HnIyUy7JRH3j6GQamK94Eq8WIpX2sYnuC

#5 @archon810
6 months ago

Great! Can we hope for inclusion in WordPress 6.7.2?

#6 @mukesh27
6 months ago

Hi there, Thanks for ticket.

Instead of removing the CSS we should add CSS that we added in frontend in [59415]

img:is([sizes="auto" i], [sizes^="auto," i]) {
    contain-intrinsic-size: 3000px 1500px;
}

#7 @sainathpoojary
6 months ago

hey @mukesh27,

I attempted to implement the provided CSS solution:

img:is([sizes="auto" i], [sizes^="auto," i]) {
    contain-intrinsic-size: 3000px 1500px;
}

However, this resulted in behavior that seems different from what we had in WordPress v6.6.1. Here’s the comparison:

https://utfs.io/f/PL8E4NiPUWyODJv0JdAHytsWpNIfogBi6bRx3aQ5ZFMdLhY1

But after adding the suggested CSS, this is the current result:

https://utfs.io/f/PL8E4NiPUWyOqSCREtFX9AiSFV8fHmyxUp5oh3rcqWCNB1LI

This issue appears to be linked to the fact that we previously set height: auto, which allowed the image to take its contain-intrinsic-size (1500px), as shown in the preview below:

https://utfs.io/f/PL8E4NiPUWyOWfLNaNf7vRTdgHAZJIiLnBPhzUw3Yx4NMe0m

Also, I noticed some inconsistencies between Firefox and Chrome after following thecontain-intrinsic-size approach:

https://utfs.io/f/PL8E4NiPUWyOW22SLy7vRTdgHAZJIiLnBPhzUw3Yx4NMe0mq

Although removing height:auto was working as intended because it was taking the actual height of the image

https://utfs.io/f/PL8E4NiPUWyOyP17zPurklRUAJtWNBdDhG4x38K5vZL2FHcf

While the removal of height: auto behavior seems to work as expected, I’m curious about your thoughts on this. Could there be another approach to fix the issue while maintaining consistency across browsers? Any advice would be appreciated!

#8 @archon810
5 months ago

Can the dev team please prioritize the fix for the next hotfix release? The icons have been looking broken for weeks.

This ticket was mentioned in Slack in #core-media by archon810. View the logs.


5 months ago

This ticket was mentioned in Slack in #core by archon810. View the logs.


4 months ago

@joemcgill commented on PR #7910:


4 months ago
#11

Alternately, I think we could consider disabling auto-sizes prior to generating this image markup in _wp_post_thumbnail_html() here.

#12 @joemcgill
4 months ago

  • Milestone changed from Awaiting Review to 6.8
  • Owner set to joemcgill
  • Status changed from new to reviewing

I've left some feedback on the PR. @sainathpoojary are you able to update the approach?

#13 @sainathpoojary
4 months ago

Hey @joemcgill,

I’ve updated the PR to remove width: auto as suggested and have tested the featured image with multiple image sizes. Whenever you have a moment, I’d appreciate it if you could take a look.

Testing video: https://rioudcpuyg.ufs.sh/f/PL8E4NiPUWyOSGEvqvLiQ4fwdzrJyI7ZFLWB3XOnMKUARmPD

@joemcgill commented on PR #7910:


4 months ago
#14

Thanks @SainathPoojary. bc6461f is almost right. I think we need to keep height: auto; that was removed in 9e41eae.

#15 @joemcgill
3 months ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 59773:

Post Thumbnails: Fix squashed featured image in wp-admin.

This updates the CSS for featured images in the classic editor that caused images to look skewed when auto-sizes are enabled.

Props maciejmackowiak, sainathpoojary, mukesh27, joemcgill.
Fixes #62597.

#16 @joemcgill
3 months ago

  • Keywords fixed-major dev-feedback added
  • Milestone changed from 6.8 to 6.7.2
  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening for consideration for 6.7.2.

#18 @jorbin
3 months ago

  • Keywords dev-reviewed added; dev-feedback removed

[59773] looks good for backport to 6.7 branch

#19 @joemcgill
3 months ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 59778:

Post Thumbnails: Fix squashed featured image in wp-admin.

This updates the CSS for featured images in the classic editor that caused images to look skewed when auto-sizes are enabled.

Reviewed by jorbin.
Merges [59773] to the 6.7 branch.

Props maciejmackowiak, sainathpoojary, mukesh27, joemcgill.
Fixes #62597.

#20 @wordpressdotorg
4 days ago

  • Keywords has-test-info added; has-testing-info removed
Note: See TracTickets for help on using tickets.