Skip to content

[6.x] Keep the layout from shifting when scrollbars appear - #20030

Merged
brandonkelly merged 2 commits into
6.xfrom
bugfix/20011-scrollbar-layout-shift
Oct 19, 2026
Merged

brandonkelly merged 2 commits into
6.xfrom
bugfix/20011-scrollbar-layout-shift

Conversation

@riasvdv

@riasvdv riasvdv commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Classic (non-overlay) scrollbars took 15px from the layout only while content overflowed, so the content and details pane shifted when a scrollbar appeared.

 html
+  scrollbar-gutter: stable          # page scrollbar space always reserved
 <DetailsPanelContent>
-  <div class="… overflow-y-auto">
+  <div class="… overflow-y-auto [scrollbar-gutter:stable]">

.cp-details and the CP sidebar already reserve their gutter this way.

scripts/lint-tailwind-classes.mjs crashed on arbitrary-property candidates such as [scrollbar-gutter:stable], because they have no root. It now skips them.

Evidence

Chromium with classic 15px scrollbars, 1400×1300, entry edit page:

Measurement Before: no overflow → overflow After: no overflow → overflow
Details pane left edge 951px → 936px 936px → 936px
Main column width 724px → 709px 709px → 709px
Details panel field width 384px → 369px 369px → 369px

The login page, entry index and entry edit page do not scroll sideways.

vp check passes on the changed files. DetailsPanels.test.ts, ContentDetails.browser.test.ts and ScreenSkipLinks.browser.test.ts pass (32/32). composer ci passes.

Related issues

riasvdv added a commit that referenced this pull request Oct 19, 2026
@riasvdv
riasvdv force-pushed the bugfix/20011-scrollbar-layout-shift branch from a84028e to 9d28599 Compare October 19, 2026 15:24
@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

📚 Storybook previews

@craftcms/ui — open Storybook

No changed components detected in this Storybook.

resources/js — open Storybook

No changed components detected in this Storybook.

@riasvdv
riasvdv requested a review from brianjhanson October 19, 2026 15:35
@brandonkelly
brandonkelly merged commit c9aac7d into 6.x Oct 19, 2026
18 of 19 checks passed
@brandonkelly
brandonkelly deleted the bugfix/20011-scrollbar-layout-shift branch October 19, 2026 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants