Skip to content

[2.x] fix: clamp the desktop container widths to the available space - #4905

Merged
imorland merged 1 commit into
2.xfrom
im/container-width-clamp
Aug 5, 2026
Merged

[2.x] fix: clamp the desktop container widths to the available space#4905
imorland merged 1 commit into
2.xfrom
im/container-width-clamp

Conversation

@imorland

@imorland imorland commented Aug 5, 2026

Copy link
Copy Markdown
Member

The desktop band widths introduced in #4869 are not tied to the breakpoints that open them. @screen-desktop-hd is 1100px, but the hd band sets width: var(--container-hd), which is 1200px. So every viewport from 1100px to 1199px gets a container up to 100px wider than the screen.

This does not surface as a horizontal scrollbar, which is why it slipped through. body has overflow-x: hidden, 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. Reproduce by sizing a window to ~1150px wide on any page where the discussion list pane is not pinned.

(The pinned-pane path escapes it by accident: DiscussionListPane.less already sets .container { max-width: 100% } in that case.)

Changes proposed in this pull request:

Each desktop band is now clamped to the space actually available:

@media @desktop-hd  { width: ~"min(var(--container-hd), 100%)"; }
@media @desktop-xl  { width: ~"min(var(--container-xl), 100%)"; }
@media @desktop-xxl { width: ~"min(var(--container-xxl), 100%)"; }

The hd band goes fluid between 1100px and 1199px and pins to 1200px from 1200px up, which is what #4869 intended. The xl and xxl bands are not broken today (1300px at a 1600px bound, 1600px at a 2000px bound), but they get the same guard because the widths are custom properties — a theme retuning --container-xl from :root could reintroduce the identical mismatch, and core has no way to catch that.

100% rather than 100vw: body has overflow-y: scroll, so 100vw would include the scrollbar gutter and stay ~15px too wide. 100% also does the right thing when the pane is pinned, where the containing block is already narrowed by margin-left: var(--pane-width) — the clamp then means "the space left over", matching the existing override.

Reviewer notes

The existing max-width: 100% in DiscussionListPane.less is now redundant but harmless, so I left it rather than widen the diff.

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.
@imorland
imorland requested a review from a team as a code owner August 5, 2026 20:00
@imorland imorland changed the title fix: clamp the desktop container widths to the available space [2.x] fix: clamp the desktop container widths to the available space Aug 5, 2026
@imorland imorland added this to the 2.0.0-rc.6 milestone Aug 5, 2026
@imorland
imorland merged commit c5b897d into 2.x Aug 5, 2026
25 checks passed
@imorland
imorland deleted the im/container-width-clamp branch August 5, 2026 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant