Single scroller + sticky chrome

Single scroller + sticky chrome
Hello Gio
One scroll container. A bar that pins. Content below stays in normal flow. After the bar docks, the same scroller keeps moving the list under it. No JS, no nested overflow.
Layout
┌─ app (100dvh, overflow: hidden) ─────────┐
│ │
│ ┌─ scrollport (overflow-y: auto) ────┐ │
│ │ hero ← scrolls away │ │
│ │ sticky bar ← pins at top │ │
│ │ list ← grows, no overflow│ │
│ └────────────────────────────────────┘ │
└──────────────────────────────────────────┘
<div class="app">
<div class="scrollport">
<header class="hero">…</header>
<div class="bar">filters / tabs</div>
<div class="list">…</div>
</div>
</div>
.app {
height: 100dvh;
overflow: hidden;
}
.scrollport {
height: 100%;
min-height: 0;
overflow-y: auto;
}
.bar {
position: sticky;
top: 0;
z-index: 1;
flex-shrink: 0;
}
.list {
/* no height, no overflow */
}
Rules
- Lock the shell —
height: 100dvh; overflow: hiddenso the window does not scroll. - One scrollport — the child that actually moves:
min-height: 0; overflow-y: auto. - Order — departing header → sticky bar → growing content.
- List is in-flow — do not set
overflowor a fixed height on the content under the bar. - No overflow between bar and scrollport — any ancestor with
overflow: hidden | auto | scroll | clipkills sticky. Force those tovisible(orheight: auto) if a UI kit sets them.
Stacked sticky (optional)
A second column that pins under the bar:
.sidebar {
position: sticky;
top: var(--bar-height); /* measured height of the bar above */
align-self: start; /* required: stretched columns never stick */
}
Do not
.list {
height: 100%;
overflow-y: auto; /* second scroller — different pattern */
}
That pins the header forever and splits the gesture. This pattern uses one scroller the whole time.