Skip to content

Commit 084693e

Browse files
committed
fix: clamp the desktop container widths to the available space
The desktop band widths introduced in #4869 are not tied to the breakpoints that open them: the hd band starts at 1100px but sets a 1200px width, so every viewport from 1100px to 1199px got a container up to 100px wider than the screen. That does not surface as a horizontal scrollbar. `body` hides the overflow and `margin-left/right: auto` cannot resolve to a negative value, so the container is pinned to the left and its right edge is silently clipped -- the layout stops being centred and part of the header runs off-screen. Each band is now clamped with `min(..., 100%)`. The hd band goes fluid between 1100px and 1199px and pins to 1200px from 1200px up, as intended. The xl/xxl bands are not affected today, but they are clamped too: the widths are custom properties so a theme can retune them from :root and reintroduce the same mismatch. `100%` rather than `100vw`, because `body` has `overflow-y: scroll` and 100vw would include the scrollbar gutter. It also behaves correctly when the discussion list pane is pinned, where the containing block is already narrowed by the pane width.
1 parent 21db588 commit 084693e

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

framework/core/less/common/scaffolding.less

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,20 @@ p {
6868
// same fixed width, wasting half the viewport on modern displays. The widths
6969
// are CSS custom properties (see root.less) so themes can retune each band
7070
// without re-declaring the media queries.
71+
//
72+
// A band's width is not tied to the breakpoint that opens it, and a theme can
73+
// set it to anything, so each is clamped to the viewport: a width wider than
74+
// the band's own lower bound would otherwise overflow (body hides the overflow
75+
// and auto margins cannot go negative, so the layout silently clips off-centre
76+
// rather than scrolling).
7177
@media @desktop-hd {
72-
width: var(--container-hd);
78+
width: ~"min(var(--container-hd), 100%)";
7379
}
7480
@media @desktop-xl {
75-
width: var(--container-xl);
81+
width: ~"min(var(--container-xl), 100%)";
7682
}
7783
@media @desktop-xxl {
78-
width: var(--container-xxl);
84+
width: ~"min(var(--container-xxl), 100%)";
7985
}
8086
}
8187

0 commit comments

Comments
 (0)