grid with place-items: center and fixed height lets children overflow with height 100%
Categories
(Core :: Layout: Grid, defect)
Tracking
()
Tracking | Status | |
---|---|---|
firefox-esr115 | --- | unaffected |
firefox123 | --- | wontfix |
firefox124 | --- | verified |
firefox125 | --- | verified |
People
(Reporter: o.zwagers, Assigned: dholbert)
References
(Regression)
Details
(Keywords: regression)
Attachments
(11 files)
240.91 KB,
image/jpeg
|
Details | |
656 bytes,
text/html
|
Details | |
1.35 KB,
text/html
|
Details | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
phab-bot
:
approval-mozilla-beta+
|
Details | Review |
48 bytes,
text/x-phabricator-request
|
phab-bot
:
approval-mozilla-beta+
|
Details | Review |
48 bytes,
text/x-phabricator-request
|
phab-bot
:
approval-mozilla-beta+
|
Details | Review |
48 bytes,
text/x-phabricator-request
|
phab-bot
:
approval-mozilla-beta+
|
Details | Review |
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:123.0) Gecko/20100101 Firefox/123.0
Steps to reproduce:
i have a grid that is used as a container to center a item within it. I use the place-items: center property to do so. The container has a fixed height (lets say 240px) and the child has a dynamic height of 100%.
Actual results:
the child is overflowing the container and therefore messing up the other content on my page.
This happens to me in firefox 123 and 125 (nightly)
Expected results:
on firefox 120, safari, and chrome the child is contained in the container with a fixed height. So when the container is 240px, the child takes up all the space in the container (but no more) and therefore also 240px
Comment 1•1 year ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::Layout: Grid' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
when setting the propertyjustify-content
to center
the child won't overflow (not that this is a fix, but maybe it will help while debugging the problem).
![]() |
||
Updated•1 year ago
|
I have attached a piece of HTML that would recreate the problem. Opening the page in safari, chrome and firefox 120 would show a gray bar which contains a aqua colored square. Firefox 123 has a aqua colored square that is full width and overflows that grid container.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.container {
height: 20rem;
width: 100%;
display: grid;
place-items: center;
background-color: whitesmoke;
}
.child {
height: 100%;
background-color: aquamarine;
aspect-ratio: 9 / 16;
}
</style>
</head>
<body>
<div class="container">
<div class="child">
</div>
</div>
</body>
</html>
Comment 5•1 year ago
|
||
Comment 6•1 year ago
|
||
Thanks for the testcase!
Bisection points to:
Bug 1350037 Part 3 - Prevent table caption from honoring justify-/align- when table is a grid item. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D196705
Updated•1 year ago
|
Assignee | ||
Comment 8•1 year ago
|
||
Calling this S2 for now since this seems to have been an unintended recently-shipped behavior-change, apparently affecting real web content.
TYLin's away for a few more days; I'll take a look in a debugger tomorrow and see if there's an obvious reason/fix.
Comment 9•1 year ago
|
||
Set release status flags based on info from the regressing bug 1350037
Assignee | ||
Comment 10•1 year ago
|
||
Assignee | ||
Comment 11•1 year ago
|
||
(In reply to Mayank Bansal from comment #6)
Bisection points to:
Bug 1350037 Part 3 - Prevent table caption from honoring justify-/align- when table is a grid item. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D196705
This is indeed the exact patch (part 3 in particular) where we started having the current behavior. (The patch wasn't as table-specific in its impact as it intended to be, I think.)
Specifically: if I restore the removed chunk of code here...
https://hg.mozilla.org/mozilla-central/rev/6e8085865f74#l1.12
...then we get the expected results here (smaller left/right/center-aligned purple boxes for all but the final line of https://bugzilla.mozilla.org/attachment.cgi?id=9388827 )
Assignee | ||
Comment 12•1 year ago
|
||
This patch essentially restores a chunk of code that we removed in this commit:
https://hg.mozilla.org/mozilla-central/rev/6e8085865f74
I think that commit intended to exempt this code from being run for
table-wrapper-frames that are grid items; but we need that code to get
shrink-wrapping (and alignment) for other sorts of frames that are grid items.
Updated•1 year ago
|
Comment 13•1 year ago
•
|
||
Daniel, should this patch have landed in Nightly by now? I am on build ID 20240303091237 and can still see https://codepen.io/scheinercc/pen/MWxMWqP from bug 1881671.
Comment 14•1 year ago
|
||
No, the patch hasn't even been reviewed yet. Once the patch reaches mozilla-central, a comment will be left in the bug and it will be closed as RESOLVED FIXED. After that, it should be in the following nightly build.
Comment 15•1 year ago
|
||
Wontfix for 123 given that our planned dot release builds today.
Comment 16•1 year ago
|
||
Bug 1350037 Part 3 [1] removed the code in ReflowInput that adds ShrinkWrap
flag self-aligned grid items, to prevent the table-caption from getting aligned
behavior, but it accidentally broke self-aligned behavior for other types of
frames that are grid items.
We actually already check if we need to add ShrinkWrap
in grid item's final
reflow [2], but missing the same logic in MeasuringReflow()
. This patch adds
that.
[1] https://hg.mozilla.org/mozilla-central/rev/6e8085865f74
[2] https://searchfox.org/mozilla-central/rev/202c48686136360a23b73a49b611a19e64f3e1b8/layout/generic/nsGridContainerFrame.cpp#7651,7657
Updated•1 year ago
|
Assignee | ||
Comment 17•1 year ago
|
||
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Assignee | ||
Comment 18•1 year ago
|
||
Try run, with the current patch stack: https://treeherder.mozilla.org/jobs?repo=try&revision=90669c22313d121810db2e6e8437ff030ef6918b
(reftests, crashtests, mochitests, web-platform-tests; excluding ASAN/TSAN),
Comment 19•1 year ago
|
||
Daniel, thank your for fixing this regression of mine while I'm away!
Assignee | ||
Comment 20•1 year ago
|
||
Sure! I was hoping to finish off the fix last week; thanks for the suggested alternate approach & helping push it over the line! :)
Assignee | ||
Comment 21•1 year ago
|
||
This test's setup is a little more special (some text with a linewrap that's
forced by a negative margin-inline-end), so I'm not bothering to give it a
particularly descriptive name; I'm just following the convention of
[browser]-[bug]-[number] that we have for e.g. chrome-bug-001.html nearby (with
the actual bug number, in this case).
This test is based on the testcase from the duplicate bug, which was:
https://bugzilla.mozilla.org/show_bug.cgi?id=1881671
Comment 22•1 year ago
|
||
Comment 24•1 year ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/14866c74663f
https://hg.mozilla.org/mozilla-central/rev/09c6c8619b8f
https://hg.mozilla.org/mozilla-central/rev/90da9f730286
https://hg.mozilla.org/mozilla-central/rev/89e481cfc788
Comment 25•1 year ago
|
||
The patch landed in nightly and beta is affected.
:dholbert, is this bug important enough to require an uplift?
- If yes, please nominate the patch for beta approval.
- If no, please set
status-firefox124
towontfix
.
For more information, please visit BugBot documentation.
Assignee | ||
Comment 26•1 year ago
|
||
Bug 1350037 Part 3 [1] removed the code in ReflowInput that adds ShrinkWrap
flag self-aligned grid items, to prevent the table-caption from getting aligned
behavior, but it accidentally broke self-aligned behavior for other types of
frames that are grid items.
We actually already check if we need to add ShrinkWrap
in grid item's final
reflow [2], but we were missing the same logic in MeasuringReflow()
. This
patch adds that.
[1] https://hg.mozilla.org/mozilla-central/rev/6e8085865f74
[2] https://searchfox.org/mozilla-central/rev/202c48686136360a23b73a49b611a19e64f3e1b8/layout/generic/nsGridContainerFrame.cpp#7651,7657
Original Revision: https://phabricator.services.mozilla.com/D203514
Updated•1 year ago
|
Assignee | ||
Comment 27•1 year ago
|
||
Original Revision: https://phabricator.services.mozilla.com/D203349
Updated•1 year ago
|
Assignee | ||
Comment 28•1 year ago
|
||
Original Revision: https://phabricator.services.mozilla.com/D203515
Updated•1 year ago
|
Assignee | ||
Comment 29•1 year ago
|
||
This test's setup is a little more special (some text with a linewrap that's
forced by a negative margin-inline-end), so I'm not bothering to give it a
particularly descriptive name; I'm just following the convention of
[browser]-[bug]-[number] that we have for e.g. chrome-bug-001.html nearby (with
the actual bug number, in this case).
This test is based on the testcase from the duplicate bug, which was:
https://bugzilla.mozilla.org/show_bug.cgi?id=1881671
Original Revision: https://phabricator.services.mozilla.com/D203534
Updated•1 year ago
|
Assignee | ||
Comment 30•1 year ago
|
||
I verified that the attached testcases render as-expected (and match Chrome's rendering) with the latest Nightly, 125.0a1 (2024-03-05) (64-bit)
Marking VERIFIED for v125, and requesting beta uplift.
Comment 31•1 year ago
|
||
Uplift Approval Request
- String changes made/needed: None
- Risk associated with taking this patch: Low
- Is Android affected?: yes
- User impact if declined: Layout issues (content overlapping and/or too large) on certain sites that use CSS Grid
- Fix verified in Nightly: yes
- Code covered by automated testing: yes
- Explanation of risk level: Extremely targeted change, which makes the code more consistent and returns us to doing something that we were previously doing before this regressed.
- Steps to reproduce for manual QE testing: Load https://bugzilla.mozilla.org/attachment.cgi?id=9388827 and compare rendering to Chrome. Only the bottom two purple boxes should overflow from their black container.
- Needs manual QE test: yes
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Comment 32•1 year ago
•
|
||
:dholbert can you take a look at the code review failure on https://phabricator.services.mozilla.com/D203647?
(edit) must of been an weird error lando was throwing. I was not able to land this, however as you can see below, it did land.
Updated•1 year ago
|
Comment 33•1 year ago
|
||
uplift |
Updated•1 year ago
|
Updated•1 year ago
|
Comment 35•1 year ago
|
||
Verified as fixed in our latest Beta 124.0b8.
Description
•