From a7e9824c3d51529fcd2fef5b8b3f961ad97f15e1 Mon Sep 17 00:00:00 2001 From: chaokunyang Date: Sun, 14 Jun 2026 13:27:25 +0800 Subject: [PATCH] Fix docs sidebar clipping on wide screens --- src/css/custom.css | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/css/custom.css b/src/css/custom.css index 98d24b3830b..117bfab0e00 100644 --- a/src/css/custom.css +++ b/src/css/custom.css @@ -179,11 +179,18 @@ --fory-doc-wide-width: 988px; --fory-doc-gutter-width: 18px; --fory-doc-sidebar-inset: 2rem; + --fory-doc-sidebar-panel-width: 300px; + --fory-doc-sidebar-offset: max(0px, calc((100vw - var(--fory-layout-width)) / 2)); --fory-doc-toc-right-inset: 1.5rem; } html:root { - --doc-sidebar-width: 300px; + /* + * The menu is aligned with the centered navbar on wide screens. Keep the + * Docusaurus sidebar at least that wide, otherwise its overflow clipping + * hides the menu and the sidebar looks empty. + */ + --doc-sidebar-width: calc(var(--fory-doc-sidebar-panel-width) + var(--fory-doc-sidebar-offset)); } .theme-doc-breadcrumbs, @@ -345,7 +352,7 @@ html:root { @media (min-width: 997px) { .theme-doc-sidebar-menu { - padding-left: max(.75rem, calc((100vw - var(--fory-layout-width)) / 2)); + padding-left: max(.75rem, var(--fory-doc-sidebar-offset)); } }