Open Bug 1920525 Opened 2 months ago Updated 2 months ago

content-visibility: auto causes object-fit to no longer apply once image element has left and re-entered the viewport

Categories

(Core :: Layout, defect)

Firefox 130
defect

Tracking

()

Tracking Status
firefox-esr115 --- unaffected
firefox-esr128 --- affected
firefox130 --- wontfix
firefox131 --- wontfix
firefox132 --- fix-optional

People

(Reporter: lewisl, Unassigned, NeedInfo)

References

(Regression)

Details

(Keywords: nightly-community, regression)

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36

Steps to reproduce:

Create a wrapping element with a fixed aspect ratio. Add an image with a visibly different aspect ratio to it with width and height set to 100%, object-fit set to contain and content-visibility set to auto. Observe that object-fit keeps the visible image proportions correct. Scroll the page so the image has fully left the viewport. Scroll the image back into view.

Bare bones CodePen example here: https://codepen.io/enigmalewislane/pen/VwowpNm

Actual results:

The image reappears without object-fit applied. Trying to change the value of object-fit or enabling/disabling it in dev tools has no effect, and the image remains stretched/squashed.

Expected results:

The image should reappear looking the same as it did when it left the viewport.

The Bugbug bot thinks this bug should belong to the 'Core::Layout' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Layout
Product: Firefox → Core

Set release status flags based on info from the regressing bug 1804761

:daniel do you think you can take a look and assign a priority/severity here?

Thanks for the bug report!

Here's a version of the testcase that automatically scrolls down+up after 500ms and triggers the bug (for me at least).

Triaging as S3 (regular-severity) given we've been shipping with this for a while. Seems like it's probably not too complex of a fix, though. Leaving ni=me to investigate further (probably can't today but hope to do so soon).

Severity: -- → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: