| Summary: | Layout bug with nested grid inside flex | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Tomas Carnecky <tomc> |
| Component: | Layout and Rendering | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED DUPLICATE | ||
| Severity: | Normal | CC: | ahmad.saleem792, bfulgham, chernodubv, estea, karlcow, maggotfish, rego, simon.fraser, svillar, tombigel, webkit-bug-importer, webkit-layout-noreply, zalan |
| Priority: | P2 | Keywords: | BrowserCompat, InRadar |
| Version: | Safari Technology Preview | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
|
Description
Tomas Carnecky
2021-06-01 22:28:59 PDT
This is not a safari-specific bug, I can reproduce it in GTK port using mini-browser. This looks like a flexbox or grid layout issue, so not platform specific at all. For some reason, the grid container calculates its height based on the page height. So the content is at the center of the page, rather than at the center of the parent container. Here's a more concise example:
---
<div class="flex">
<div class="grid">Content</div>
</div>
<style>
.flex {
display: flex;
flex-direction: column;
}
.grid {
background: yellow;
display: grid;
grid-auto-flow: column;
justify-content: center;
align-items: center;
height: 100%;
}
</style>
We have another case that could be related (same?). See example: https://jsbin.com/henosigusa/1/edit?html,css,output It's a structure of: flex > grid > flex. with a min-height on the outer flex. ------ <div class="flex min-height"> <div class="grid"> <div class="flex"> <div class="content">Hello1</div> <div class="content">Hello2</div> <div class="content">Hello3</div> <div class="content">Hello4</div> </div> </div> </div> <style> .grid { display: grid; } .flex { display: flex; flex-direction: column; } .flex > * { flex-grow: 1; } .min-height { min-height: 90px; } </style> ------ It appears that the min-height is affecting the content, and if the height of the content can't be contained inside the container, the min-height is applied to the .content items inside the inner flex. Seems to be WebKit only. https://jsbin.com/henosigusa/1/edit?html,css,output <- works in Safari Technology Preview 198 while fails in Safari 17.6 Beta. Same is the case with - https://dor1x.csb.app/. Marking this as 'RESOLVED CONFIGURATION CHANGED'. progressed at https://commits.webkit.org/276880@main *** This bug has been marked as a duplicate of bug 271843 *** |