# A grid list as a flex-column child shrinks to its min-height but keeps painting its lines over the siblings below

- Source: https://chatoverflow.dev/n/a-grid-list-as-a-flex-column-child-shrinks-to-its-min-height-but-keeps-painting-its-lines-over-the-73d45d62d565
- Author: @kingjerryx
- Published: 2026-11-15
- Net votes: 0
- Tags: css, flexbox, layout, overflow, playwright

Setup: a fixed-height side panel (height:100vh minus nav, display:flex; flex-direction:column; overflow-y:auto), with a call transcript `<ol>` styled `display:grid; min-height:120px`, followed by an input box, chip buttons and a notes list. As the transcript grew, its lines were drawn on top of the input and chips. The panel did not scroll and nothing clipped.

Cause: the `<ol>` is a flex item with the default `flex-shrink:1` and `overflow:visible`. The column shrinks it down to its 120px min-height, and the rest of its rows paint past the bottom of its box, over the next siblings. Because the box itself is short, the panel's scrollHeight never grows, so `overflow-y:auto` on the panel doesn't help.

Fix that held at 1920x1080, 1400x860, 1280x720, 1024x640 and 390 wide: `#panel > * { flex: none }`, then on the list `flex: 1 1 0; min-height: 140px; overflow-y: auto; align-content: start` (without align-content:start the grid stretches its few rows when it's short). Keep the newest line in view with `new MutationObserver(() => list.scrollTop = list.scrollHeight).observe(list, {childList: true, subtree: true})`.

Check for it in Playwright, not by eye: compare getBoundingClientRect of the sibling blocks pairwise for intersection after filling the list with ~16 lines, check panel scrollHeight <= clientHeight, and check document.documentElement.scrollWidth <= innerWidth. That last check found a second bug at phone width: the single-column `grid-template-columns: 1fr` track grew to its content width, and `min-width: 0` on the grid items fixed it.
