Skip to content

Commit 1b441d7

Browse files
committed
Revert "Merge pull request #70 from zerodevapp/fix/pillar-bar-mobile-desktop"
This reverts commit 5b244be, reversing changes made to 9c2aecf.
1 parent 5b244be commit 1b441d7

1 file changed

Lines changed: 15 additions & 33 deletions

File tree

vocs.config.tsx

Lines changed: 15 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,9 +1301,8 @@ export default defineConfig({
13011301
margin-top: var(--zd-pillar-bar-height);
13021302
}
13031303
1304-
/* Pillar bar: horizontal nav directly below the top header. Inserted in-flow
1305-
right after Vocs's gutterTop; pinned fixed on desktop (below), in-flow on
1306-
mobile (see media query). */
1304+
/* Pillar bar: fixed horizontal nav directly below the top header.
1305+
Mounted at document.body so it escapes the fixed-height gutterTop. */
13071306
.zd-pillar-bar {
13081307
position: fixed;
13091308
top: var(--vocs-topNav_height, 56px);
@@ -1314,16 +1313,13 @@ export default defineConfig({
13141313
align-items: center;
13151314
gap: 4px;
13161315
height: var(--zd-pillar-bar-height);
1317-
/* Start the bar AFTER the sidebar gutter instead of spanning full width.
1318-
Vocs's leftGutterWidth var is scoped to .vocs_DocsLayout (not visible on
1319-
body), so recompute the same max() here. Anchoring left to it keeps the
1320-
bar from overlapping the fixed sidebar (gutterLeft, z-index 14) — the
1321-
pillar bar's z-index 50 would otherwise paint over the sidebar's top. */
1322-
left: max(
1316+
/* Match Vocs's leftGutterWidth calc — that variable is scoped to
1317+
.vocs_DocsLayout so it's not visible on body. Recompute it here using
1318+
:root-scoped vars so the bar's content aligns with the search bar. */
1319+
padding-left: max(
13231320
calc((100vw - var(--vocs-content_width)) / 2),
13241321
var(--vocs-sidebar_width)
13251322
);
1326-
padding-left: 0;
13271323
padding-right: 24px;
13281324
border-bottom: 1px solid var(--vocs-color_border);
13291325
background: var(--vocs-color_background);
@@ -1353,21 +1349,12 @@ export default defineConfig({
13531349
background: var(--vocs-color_backgroundIrisTint);
13541350
}
13551351
1356-
/* On narrow viewports Vocs makes the top nav position:initial (in normal flow)
1357-
and shows a sticky section curtain below it. The bar is inserted in-flow
1358-
right after the top nav, so drop the fixed positioning and let it stack
1359-
naturally — a fixed bar would float over and hide that curtain. No sidebar
1360-
gutter here either, so span full width. */
1352+
/* On narrow viewports, Vocs hides the desktop top nav and shows a mobile drawer.
1353+
Hide the pillar bar there too — Vocs's mobile menu will surface pillar links via
1354+
the sidebar. */
13611355
@media (max-width: 1080px) {
1362-
.zd-pillar-bar {
1363-
position: static;
1364-
padding-left: 8px;
1365-
/* Match the mobile top nav / curtain background (both use backgroundDark). */
1366-
background: var(--vocs-color_backgroundDark);
1367-
}
1368-
/* Top nav is in-flow on mobile, so content needs no extra top padding;
1369-
the in-flow bar already occupies its own space. */
1370-
.vocs_DocsLayout_content { padding-top: 0 !important; }
1356+
.zd-pillar-bar { display: none; }
1357+
.vocs_DocsLayout_content { padding-top: var(--vocs-topNav_height, 56px) !important; }
13711358
.vocs_DocsLayout_gutterRight { margin-top: 0; }
13721359
}
13731360
</style>`;
@@ -1415,16 +1402,11 @@ export default defineConfig({
14151402
14161403
function mount() {
14171404
if (document.getElementById('zd-pillar-bar')) return;
1418-
// Insert as a sibling right after Vocs's top-nav container so the bar lives
1419-
// in normal document flow. On desktop (>=1081px) the CSS pins it with
1420-
// position:fixed (DOM position irrelevant). On mobile (<=1080px) Vocs makes
1421-
// the top nav position:initial (in-flow) and shows a sticky section curtain;
1422-
// an in-flow bar here sits correctly below the nav instead of a fixed bar
1423-
// floating over and hiding that curtain.
1424-
var gutterTop = document.querySelector('.vocs_DocsLayout_gutterTop');
1425-
if (!gutterTop || !gutterTop.parentNode) return;
1405+
if (!document.body) return;
14261406
var bar = build();
1427-
gutterTop.parentNode.insertBefore(bar, gutterTop.nextSibling);
1407+
// Mount at body level so it escapes Vocs's fixed-height gutterTop container.
1408+
// The CSS pins it via position:fixed below the existing top nav.
1409+
document.body.appendChild(bar);
14281410
updateActive();
14291411
}
14301412

0 commit comments

Comments
 (0)