Skip to content

Commit 1c54f6a

Browse files
AmazingAngclaude
andcommitted
Fix mobile tab bar: fixed positioning + unified CSS variables for cross-browser compat
- Tab bar now position:fixed at viewport bottom, visible in all browsers - Unified CSS variables: --mobile-tab-h, --mobile-tab-offset, --mobile-tab-total - All bottom-dependent layouts use variables (map-section, panel-view, more-menu) - Retain both env(safe-area-inset-bottom) and visualViewport fallback - Add visualViewport scroll listener for extra browser compat Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
1 parent 610f049 commit 1c54f6a

2 files changed

Lines changed: 17 additions & 7 deletions

File tree

src/app/globals.css

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,12 @@ body.panel-drag-active .bottom-panels-grid-empty::after {
341341

342342
/* Mobile */
343343
@media (max-width: 768px) {
344+
:root {
345+
--mobile-tab-h: 52px;
346+
--mobile-tab-offset: max(env(safe-area-inset-bottom), var(--browser-bottom-bar, 0px));
347+
--mobile-tab-total: calc(var(--mobile-tab-h) + var(--mobile-tab-offset));
348+
}
349+
344350
/* Header 压缩为 40px */
345351
header { height: 40px !important; }
346352

@@ -351,8 +357,7 @@ body.panel-drag-active .bottom-panels-grid-empty::after {
351357
padding: 0;
352358
}
353359
.map-section {
354-
/* 40px header + 52px tab bar base + safe-area/browser-bottom-bar padding */
355-
height: calc(100dvh - 40px - 52px - max(env(safe-area-inset-bottom), var(--browser-bottom-bar, 0px))) !important;
360+
height: calc(100dvh - 40px - var(--mobile-tab-total)) !important;
356361
min-height: 50vh !important;
357362
}
358363
/* Mobile: single-column cards */
@@ -368,7 +373,7 @@ body.panel-drag-active .bottom-panels-grid-empty::after {
368373
position: fixed;
369374
left: 0;
370375
right: 0;
371-
bottom: 52px; /* above tab bar */
376+
bottom: var(--mobile-tab-total); /* above tab bar */
372377
height: 40dvh;
373378
z-index: 40;
374379
background: var(--bg);
@@ -407,14 +412,17 @@ body.panel-drag-active .bottom-panels-grid-empty::after {
407412

408413
/* Mobile tab bar */
409414
.mobile-tab-bar {
415+
position: fixed;
416+
bottom: 0;
417+
left: 0;
418+
right: 0;
410419
display: flex;
411420
align-items: stretch;
412-
height: 52px;
421+
height: var(--mobile-tab-h);
413422
background: var(--panel-bg);
414423
border-top: 1px solid var(--border);
415-
flex-shrink: 0;
416424
z-index: 50;
417-
padding-bottom: max(env(safe-area-inset-bottom), var(--browser-bottom-bar, 0px));
425+
padding-bottom: var(--mobile-tab-offset);
418426
}
419427

420428
.mobile-tab {
@@ -452,7 +460,7 @@ body.panel-drag-active .bottom-panels-grid-empty::after {
452460
/* More menu */
453461
.mobile-more-menu {
454462
position: fixed;
455-
bottom: 52px;
463+
bottom: var(--mobile-tab-total);
456464
left: 0;
457465
right: 0;
458466
z-index: 55;

src/app/page.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1849,9 +1849,11 @@ function MobileTabBar({ activePanel, onSelect }: { activePanel: string | null; o
18491849
};
18501850
update();
18511851
window.visualViewport?.addEventListener("resize", update);
1852+
window.visualViewport?.addEventListener("scroll", update);
18521853
return () => {
18531854
cancelAnimationFrame(rafId);
18541855
window.visualViewport?.removeEventListener("resize", update);
1856+
window.visualViewport?.removeEventListener("scroll", update);
18551857
};
18561858
}, []);
18571859

0 commit comments

Comments
 (0)