Closed Bug 2046642 Opened 8 days ago Closed 7 days ago

Ignore `visibility:collapse` flex items when inserting gaps in flex main axis

Categories

(Core :: Layout: Flexbox, defect)

defect

Tracking

()

RESOLVED FIXED
153 Branch
Tracking Status
firefox153 --- fixed

People

(Reporter: dholbert, Assigned: emilio)

References

Details

Attachments

(2 files)

Attached file testcase 1

STR:

  1. Load attached testcase.

EXPECTED RESULTS:
Equally spaced boxes.

ACTUAL RESULTS:
Extra big gap between the first two items.

The flex item there is "collapsed" with visibility:collapse, which means we're supposed to ignore it except for the purpose of establishing the line's cross size.

https://drafts.csswg.org/css-flexbox-1/#visibility-collapse
https://drafts.csswg.org/css-flexbox-1/#algo-visibility

Note that Chrome doesn't implement this special behavior ( https://issues.chromium.org/issues/41085247 ) so don't use them as a reference here.

(This was part of the cause of bug 2030313, as Emilio noted over there.)

Assignee: nobody → emilio
Status: NEW → ASSIGNED
Pushed by ealvarez@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/a46a009084aa https://hg.mozilla.org/integration/autoland/rev/15cd8a4981ed Fix interaction of gap and visibility: collapse in flex containers. r=dholbert,layout-reviewers,dshin

For the reference case that was updated in this patch -- flexbox-collapsed-item-horiz-001-ref.html: I wrote it based on an older version of the flexbox spec, which accounted for visibility:collapse during flex layout...
https://www.w3.org/TR/2014/WD-css-flexbox-1-20140325/#visibility-collapse

...but did not have any special handling/exclusion for visibility:collapse items during intrinsic sizing:
https://www.w3.org/TR/2014/WD-css-flexbox-1-20140325/#intrinsic-sizes
("The max-content main size of a flex container is the sum of the flex container’s items' max-size contributions in the main axis." -- note "items", no exclusion of items-that-are-collapsed, or special definition for their max-size contribution)

I briefly thought this issue persisted in the current flexbox spec, and I filed https://github.com/w3c/csswg-drafts/issues/14039 to get that addressed -- but after filing, I noticed it does now call out "non-collapsed items" as the things to be considered during intrinsic sizing (in https://drafts.csswg.org/css-flexbox/#intrinsic-sizes ).

So: tl;dr, the test change makes sense and is aligned with the spec. :)

Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/60572 for changes under testing/web-platform/tests

Pushed by agoloman@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/e1613ad57e0a https://hg.mozilla.org/mozilla-central/rev/0fb1ae1b6065 Fix interaction of gap and visibility: collapse in flex containers. r=dholbert,layout-reviewers,dshin
Status: ASSIGNED → RESOLVED
Closed: 7 days ago
Resolution: --- → FIXED
Target Milestone: --- → 153 Branch

Upstream PR merged by moz-wptsync-bot

QA Whiteboard: [qa-triage-done-c154/b153]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: