Skip to content

Commit fd000a9

Browse files
Monil-KTXktx-abhishek
authored andcommitted
fix: update secondary sidebar styles for consistent height and scroll… (#212)
* fix: update secondary sidebar styles for consistent height and scroll behavior * fix: ensure secondary sidebar is hidden on small screens
1 parent 1ac9d59 commit fd000a9

File tree

1 file changed

+86
-16
lines changed

1 file changed

+86
-16
lines changed

docs/stylesheets/extra.css

Lines changed: 86 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,6 @@
22
.md-search__close {
33
display: none !important;
44
}
5-
/* === FINAL SECONDARY SIDEBAR POSITIONING OVERRIDE === */
6-
.md-sidebar--secondary,
7-
.md-sidebar--secondary[data-md-component="sidebar"],
8-
.md-sidebar--secondary[data-md-state],
9-
.md-sidebar--secondary[data-md-state="lock"] {
10-
position: sticky !important;
11-
top: 8rem !important;
12-
transform: none !important;
13-
transition: none !important;
14-
will-change: auto !important;
15-
z-index: 200 !important;
16-
}
175

186
/* STRONG FINAL MOBILE SCROLL FIX (highest priority):
197
Lock the sidebar inner to the viewport and force the scrollwrap to handle
@@ -786,6 +774,64 @@ html .md-sidebar--primary {
786774
display: none !important;
787775
}
788776

777+
/* ------------------------------------------------------------------ */
778+
/* Mirror primary sidebar height/scroll behavior for secondary only */
779+
/* Only height/scroll/positioning properties are applied to avoid */
780+
/* changing colors, spacing, or layout in other views. */
781+
/* ------------------------------------------------------------------ */
782+
.md-sidebar--secondary,
783+
.md-sidebar--secondary[data-md-component="sidebar"],
784+
.md-sidebar--secondary[data-md-state],
785+
.md-sidebar--secondary[data-md-state="lock"] {
786+
/* Match primary's sticky positioning and footer clearance */
787+
position: sticky !important;
788+
top: 8rem !important;
789+
transform: none !important;
790+
transition: none !important;
791+
will-change: auto !important;
792+
z-index: 200 !important;
793+
794+
/* Content-based height with same footer clearance as primary */
795+
height: auto !important;
796+
min-height: auto !important;
797+
max-height: calc(100vh - 9rem) !important;
798+
overflow: hidden !important;
799+
display: block !important;
800+
}
801+
802+
/* Ensure inner container is content-based like primary */
803+
.md-sidebar--secondary .md-sidebar__inner {
804+
height: auto !important;
805+
min-height: auto !important;
806+
display: block !important;
807+
overflow: hidden !important;
808+
}
809+
810+
/* Provide a scrollwrap that matches primary's behavior and clearance */
811+
.md-sidebar--secondary .md-sidebar__scrollwrap {
812+
overflow-y: auto !important;
813+
padding: 0.25rem 0 1rem !important;
814+
overscroll-behavior: contain !important;
815+
width: 100% !important;
816+
padding-right: 0 !important;
817+
margin-right: 0 !important;
818+
box-sizing: border-box !important;
819+
/* Allow content-based height but limit to viewport minus footer/header */
820+
height: auto !important;
821+
max-height: calc(100vh - 12rem) !important;
822+
}
823+
824+
/* Remove potential masking pseudo-elements that could hide final items */
825+
.md-sidebar--secondary .md-sidebar__scrollwrap:after {
826+
display: none !important;
827+
}
828+
.md-sidebar--secondary:before,
829+
.md-sidebar--secondary:after,
830+
.md-sidebar--secondary .md-sidebar__inner:before,
831+
.md-sidebar--secondary .md-sidebar__inner:after {
832+
display: none !important;
833+
}
834+
789835
.md-header {
790836
position: fixed !important;
791837
top: 70px !important;
@@ -1457,7 +1503,7 @@ nav.md-grid {
14571503
width: 100%;
14581504
margin-left: auto;
14591505
margin-right: auto;
1460-
padding-left: 1rem; /* px-4 */
1506+
padding-left: 1rem; /* px-4 */
14611507
padding-right: 1rem;
14621508
display: flex;
14631509
align-items: center;
@@ -1467,7 +1513,7 @@ nav.md-grid {
14671513
@media (min-width: 640px) {
14681514
.md-main__inner.md-grid {
14691515
max-width: 640px;
1470-
padding-left: 1.5rem; /* sm:px-6 */
1516+
padding-left: 1.5rem; /* sm:px-6 */
14711517
padding-right: 1.5rem;
14721518
}
14731519
}
@@ -1483,7 +1529,7 @@ nav.md-grid {
14831529
@media (min-width: 1024px) {
14841530
.md-main__inner.md-grid {
14851531
max-width: 1024px;
1486-
padding-left: 2rem; /* lg:px-8 */
1532+
padding-left: 2rem; /* lg:px-8 */
14871533
padding-right: 2rem;
14881534
justify-content: space-between; /* lg:justify-between */
14891535
}
@@ -1493,7 +1539,7 @@ nav.md-grid {
14931539
@media (min-width: 1280px) {
14941540
.md-main__inner.md-grid {
14951541
max-width: 1480px;
1496-
padding-left: 2.5rem; /* xl:px-10 */
1542+
padding-left: 2.5rem; /* xl:px-10 */
14971543
padding-right: 2.5rem;
14981544
}
14991545
}
@@ -1504,3 +1550,27 @@ nav.md-grid {
15041550
max-width: 70rem;
15051551
}
15061552
}
1553+
1554+
/* Strong mobile hide: ensure secondary sidebar stays hidden on small screens
1555+
This rule targets the same selector variants used elsewhere and is placed
1556+
at the end of the stylesheet with !important to avoid accidental overrides. */
1557+
@media (max-width: 76.24em) {
1558+
.md-sidebar--secondary,
1559+
.md-sidebar--secondary[data-md-component="sidebar"],
1560+
.md-sidebar--secondary[data-md-state],
1561+
.md-sidebar--secondary[data-md-state="lock"] {
1562+
display: none !important;
1563+
visibility: hidden !important;
1564+
pointer-events: none !important;
1565+
transform: none !important; /* neutralize any transforms */
1566+
}
1567+
1568+
/* Also make sure secondary inner containers don't show up */
1569+
.md-sidebar--secondary .md-sidebar__inner,
1570+
.md-sidebar--secondary .md-sidebar__scrollwrap,
1571+
.md-nav--secondary {
1572+
display: none !important;
1573+
visibility: hidden !important;
1574+
pointer-events: none !important;
1575+
}
1576+
}

0 commit comments

Comments
 (0)