Skip to content

fix: set scrollbar-gutter stable - #5310

Open
bluwy wants to merge 2 commits into
mainfrom
set-scrollbar-gutter
Open

fix: set scrollbar-gutter stable#5310
bluwy wants to merge 2 commits into
mainfrom
set-scrollbar-gutter

Conversation

@bluwy

@bluwy bluwy commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Description

Use scrollbar-gutter to always preserve a space for scrollbars, even if it exists or not. This addresses the layout shift when navigating between pages that have scrollbars or not, and when opening/closing the search modal

Linked Issues

fixes #4884
fixes #1054
alternative to #1844 (that PR makes the scrollbar overlay instead of taking up space) (if this is merged, closes #1844)

Additional Context


Tip

The author can publish a preview release by commenting /publish after creating the PR.

@brc-dd

brc-dd commented Jul 13, 2026

Copy link
Copy Markdown
Member

One issue with scrollbar-gutter is that the browser doesn't paint things behind the gutter. So, the navbar/footer/gradient will appear to be cut near the right when the gutter is empty. Hold off merging this for now, I'll take a look to see if there is some better way.

@bluwy

bluwy commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator Author

In most cases it's not really obvious or visible, so I think it's fine. The worst case seems to be for Safari which forces an ugly theme-color background for the scrollbar (can't seem to workaround this):
image

I think it's still fine for Safari though, for those who use it. Otherwise the only other option is with #1844 which uses width: 100vw and overflow-x: hidden, which we might need to take special care of handling in a few places. Too bad browsers don't have a supported way to support gutters without taking up space like overflow-y: overlay.

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.

Layout shift when search modal toggle Reduce layout shifts with classic scrollbars

2 participants