Skip to content

Scrollbar presence / absence changes top bar layoutΒ #514

@andrei-lazarov

Description

@andrei-lazarov

Describe the bug

Again obsessing over the smallest detail πŸ˜…πŸ˜…πŸ˜…

When the current page is longer than the screen, the pages becomes slightly narrower to accommodate the scrollbar.
This is enough to cause a layout shift, most notably in the top bar.

The top navigation bar must be fixed while browsing. Buttons constantly moving is very annoying.

Notice how I'm not moving my mouse, yet I'm clicking different buttons

scrollbar.mp4

To Reproduce

  1. Find the "perfect" width, where the scrollbar dictates whether the right-most button fits in the top bar.
  2. Flip between pages with and without the scrollbar

Probably happens on desktop only. Mobile overlays the scrollbar as far as I can tell

Expected behavior

I expect the webpage to allocate some empty space for the scrollbar?

I found scrollbar-gutter exists. This does the job, but it may not be the prettiest solution.

html {
    scrollbar-gutter: stable both-edges;
}
scrollbar-gutter.mp4

Probably the right way to do it, is some clever padding..

Affected browsers

Chrome

Stacktrace

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions