Skip to content

Commit 8983df4

Browse files
committed
fix(landing): fix sidebar fixed positioning and mobile subnav layout
Only apply fixed positioning to sidebar when expanded (not collapsed). Fix mobile subnav to top and compensate TOC popover margin.
1 parent 04b9bc5 commit 8983df4

1 file changed

Lines changed: 20 additions & 2 deletions

File tree

landing/src/styles/globals.css

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,15 +373,33 @@ html:not([data-anchor-scrolling]) {
373373
display: none;
374374
}
375375

376-
/* Sticky positioning is broken inside the fumadocs grid. Use fixed instead. */
376+
/* Sidebar: fixed positioning so it never scrolls with content, but only when expanded */
377377
@media (min-width: 768px) {
378-
[data-sidebar-placeholder] {
378+
#nd-sidebar {
379+
will-change: transform;
380+
}
381+
382+
[data-sidebar-placeholder]:not(:has(#nd-sidebar[data-collapsed="true"])) {
379383
position: fixed !important;
380384
width: var(--fd-sidebar-width) !important;
381385
inset-inline-start: max(0px, calc((100vw - var(--fd-layout-width, 97rem)) / 2)) !important;
382386
}
383387
}
384388

389+
@media (max-width: 767px) {
390+
#nd-subnav {
391+
position: fixed !important;
392+
top: var(--fd-docs-row-1, 0px) !important;
393+
inset-inline-start: 0 !important;
394+
inset-inline-end: 0 !important;
395+
}
396+
397+
/* Compensate for fixed #nd-subnav leaving grid flow */
398+
[data-toc-popover] {
399+
margin-top: 3.5rem;
400+
}
401+
}
402+
385403
[data-toc-popover] > header {
386404
position: fixed !important;
387405
top: var(--fd-docs-row-2, 0px) !important;

0 commit comments

Comments
 (0)