From 193bd888deed6674b1a166e84ff10c59d077d41e Mon Sep 17 00:00:00 2001 From: Jean Lucas Lima Date: Mon, 29 Jun 2026 15:30:57 -0300 Subject: [PATCH] Prevent page shift when navbar dropdown opens Opening a navbar dropdown (e.g. Community) locks body scroll via `overflow: hidden`, removing the viewport scrollbar and shifting the whole page sideways by the scrollbar width on scrollable pages. Reserve the scrollbar gutter with `scrollbar-gutter: stable` on `html` so the layout width stays constant whether or not the scrollbar is present. --- src/globals.css | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/globals.css b/src/globals.css index c59480b4fd..48a261c485 100644 --- a/src/globals.css +++ b/src/globals.css @@ -368,6 +368,13 @@ footer { background-repeat: no-repeat; } +/* Reserve the scrollbar gutter so opening a navbar dropdown (which locks + body scroll via `overflow: hidden`) doesn't remove the scrollbar and shift + the whole page sideways by the scrollbar width. */ +html { + scrollbar-gutter: stable; +} + /* without this Headless UI breaks sticky navbar */ html:has([role="listbox"][data-open]), html:has([role="menu"][data-open]) {