Skip to content

Modern Docker Management, Designed for Everyone

fix: mobile nav sheet not working on small desktop screens

Kyle Mendell14bd338107b2
diff --git a/frontend/src/lib/components/mobile-nav/mobile-nav-sheet.svelte b/frontend/src/lib/components/mobile-nav/mobile-nav-sheet.svelte
index 4703fce8b..dfc79ce00 100644
--- a/frontend/src/lib/components/mobile-nav/mobile-nav-sheet.svelte
+++ b/frontend/src/lib/components/mobile-nav/mobile-nav-sheet.svelte
@@ -403,12 +403,19 @@
menuElement.style.overflowY = 'auto';
menuElement.style.touchAction = 'pan-y';
(menuElement.style as any).webkitOverflowScrolling = 'touch';
- // Force layout recalculation
+
+ // Multiple layout recalculations to ensure content renders
+ // First recalculation
void menuElement.offsetHeight;
-
- // Focus for accessibility
+
+ // Second recalculation after a frame
requestAnimationFrame(() => {
if (menuElement && open) {
+ // Force reflow to ensure proper rendering
+ void menuElement.offsetHeight;
+ // Reset scroll to top to ensure all content is visible
+ menuElement.scrollTop = 0;
+ // Focus for accessibility
menuElement.focus();
}
});
@@ -494,6 +501,7 @@
touch-action: pan-y;
-webkit-overflow-scrolling: touch;
overscroll-behavior: contain;
+ scroll-behavior: smooth;
${
interaction.isDragging && !isClosing
? `transform: translateY(${interaction.dragDistance}px); opacity: ${Math.max(0.3, 1 - interaction.dragDistance / 300)};`
@@ -750,10 +758,24 @@
/* Force GPU acceleration */
transform: translateZ(0);
will-change: transform, opacity;
+ /* Ensure proper stacking context for content */
+ position: fixed;
+ /* Ensure the container doesn't collapse */
+ display: flex;
+ flex-direction: column;
+ /* Fix potential layout issues when scrolled far down page */
+ pointer-events: auto;
+ contain: layout;
}
/* Remove focus outline from dialog container since it's focused for accessibility */
div[data-testid='mobile-nav-sheet']:focus {
outline: none;
}
+
+ /* Ensure content scrolls properly inside the container */
+ div[data-testid='mobile-nav-sheet'] > * {
+ /* Ensure child elements don't cause layout issues */
+ min-height: 0;
+ }
</style>
diff --git a/frontend/src/lib/components/mobile-nav/mobile-nav.svelte b/frontend/src/lib/components/mobile-nav/mobile-nav.svelte
index c00ee7182..3f44fe6b8 100644
--- a/frontend/src/lib/components/mobile-nav/mobile-nav.svelte
+++ b/frontend/src/lib/components/mobile-nav/mobile-nav.svelte
@@ -112,6 +112,10 @@
}
);
+ // Trackpad scroll wheel handling to open menu
+ let wheelScrollAccumulator = $state(0);
+ let wheelScrollTimeout: ReturnType<typeof setTimeout> | null = null;
+
// Improved scroll-to-hide using native scroll events with passive listeners
$effect(() => {
if (typeof window === 'undefined') return;
@@ -156,13 +160,51 @@
}
};
+ // Global wheel handler for trackpad scrolling to open menu
+ const handleGlobalWheel = (e: WheelEvent) => {
+ if (menuOpen || !scrollToHideEnabled) return;
+
+ // Only respond to upward scrolls (negative deltaY)
+ if (e.deltaY < 0) {
+ // Accumulate scroll distance
+ wheelScrollAccumulator += Math.abs(e.deltaY);
+
+ // Clear previous timeout
+ if (wheelScrollTimeout) {
+ clearTimeout(wheelScrollTimeout);
+ }
+
+ // If accumulated scroll is enough, open menu
+ if (wheelScrollAccumulator > 60) {
+ menuOpen = true;
+ wheelScrollAccumulator = 0;
+ }
+
+ // Reset accumulator after scroll ends
+ wheelScrollTimeout = setTimeout(() => {
+ wheelScrollAccumulator = 0;
+ }, 300);
+ } else {
+ // Reset on downward scroll
+ wheelScrollAccumulator = 0;
+ if (wheelScrollTimeout) {
+ clearTimeout(wheelScrollTimeout);
+ }
+ }
+ };
+
window.addEventListener('scroll', handleScroll, { passive: true });
+ window.addEventListener('wheel', handleGlobalWheel, { passive: true });
return () => {
window.removeEventListener('scroll', handleScroll);
+ window.removeEventListener('wheel', handleGlobalWheel);
if (scrollTimeout) {
clearTimeout(scrollTimeout);
}
+ if (wheelScrollTimeout) {
+ clearTimeout(wheelScrollTimeout);
+ }
};
});
@@ -177,8 +219,48 @@
$effect(() => {
if (navElement) {
swipeDetector.setElement(navElement);
+
+ // Handle trackpad/mouse wheel scrolling to open menu
+ const handleWheel = (e: WheelEvent) => {
+ if (menuOpen || !scrollToHideEnabled) return;
+
+ // Only respond to upward scrolls
+ if (e.deltaY < 0) {
+ // Accumulate scroll distance
+ wheelScrollAccumulator += Math.abs(e.deltaY);
+
+ // Clear previous timeout
+ if (wheelScrollTimeout) {
+ clearTimeout(wheelScrollTimeout);
+ }
+
+ // If accumulated scroll is enough, open menu
+ if (wheelScrollAccumulator > 60) {
+ menuOpen = true;
+ wheelScrollAccumulator = 0;
+ }
+
+ // Reset accumulator after scroll ends
+ wheelScrollTimeout = setTimeout(() => {
+ wheelScrollAccumulator = 0;
+ }, 300);
+ } else {
+ // Reset on downward scroll
+ wheelScrollAccumulator = 0;
+ if (wheelScrollTimeout) {
+ clearTimeout(wheelScrollTimeout);
+ }
+ }
+ };
+
+ navElement.addEventListener('wheel', handleWheel, { passive: true });
+
return () => {
swipeDetector.setElement(null);
+ navElement.removeEventListener('wheel', handleWheel);
+ if (wheelScrollTimeout) {
+ clearTimeout(wheelScrollTimeout);
+ }
};
}
});