Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
Use lvh instead of svh to fix Firefox iOS scroll jank
Maximilian Roos93ede8eb7cd1
diff --git a/docs/sass/custom.scss b/docs/sass/custom.scssindex da876824a..3fdbc8c07 100644--- a/docs/sass/custom.scss+++ b/docs/sass/custom.scss@@ -21,10 +21,9 @@ body {line-height: 1.5;color: var(--wt-color-text);background-color: var(--wt-color-bg);- // Override Juice theme's min-height: 100vh. Use --vh-full (JS-set on Firefox/- // Chrome iOS) with svh fallback to prevent scroll jank when browser chrome- // appears/disappears. See .hero comment for full explanation.- min-height: var(--vh-full, 100svh);+ // Override Juice theme's min-height: 100vh. Use lvh (large viewport height)+ // which is stable on Firefox iOS, unlike svh which behaves like dvh.+ min-height: var(--vh-full, 100lvh);}// Override Juice theme's .text class (sets font-size: 18px, we want 15px)@@ -94,13 +93,13 @@ h4 {header {// Height includes safe-area-inset so content isn't compressed on notched devices- height: calc(var(--wt-header-height) + var(--safe-area-top, env(safe-area-inset-top, 0px)));+ height: calc(var(--wt-header-height) + env(safe-area-inset-top, 0px));box-sizing: border-box; // Include border in heightbackground-color: var(--wt-color-bg-soft) !important;border-bottom: 1px solid var(--wt-color-border-subtle);padding: 0 50px;// iOS safe area: push content below notch/Dynamic Island- padding-top: var(--safe-area-top, env(safe-area-inset-top, 0px));+ padding-top: env(safe-area-inset-top, 0px);box-shadow: none !important;position: sticky;top: 0;@@ -126,7 +125,7 @@ header {right: 0;// Cover safe area inset plus header height so the browser chrome// always samples this solid color, not scrolling content beneath- height: calc(var(--safe-area-top, env(safe-area-inset-top, 0px)) + var(--wt-header-height));+ height: calc(env(safe-area-inset-top, 0px) + var(--wt-header-height));background: var(--wt-color-bg-soft);// Below header (201) so header remains interactivez-index: 200;@@ -521,8 +520,8 @@ table {border: 1px solid var(--wt-color-border-subtle);border-top: 3px solid var(--wt-color-accent);padding: 0.75rem 0 1rem;- // Use --vh-full (JS-set) with svh fallback for Firefox/Chrome iOS fix- max-height: calc(var(--vh-full, 100svh) - var(--wt-header-height) - var(--wt-main-padding-top) - 20px);+ // Use lvh which is stable on Firefox iOS (svh behaves like dvh there)+ max-height: calc(var(--vh-full, 100lvh) - var(--wt-header-height) - var(--wt-main-padding-top) - 20px);overflow-y: auto;overscroll-behavior: contain; // Trap scroll events within TOC}@@ -661,13 +660,11 @@ footer {background: radial-gradient(ellipse 80% 60% at 70% 40%, rgba(254, 243, 199, 0.7) 0%, transparent 60%),radial-gradient(ellipse 50% 40% at 30% 70%, rgba(251, 243, 219, 0.5) 0%, transparent 50%),var(--wt-color-bg-soft) !important;- // Use --vh-full (JS-set on Firefox/Chrome iOS) with svh fallback.- // Firefox/Chrome iOS incorrectly implement svh as dvh, causing scroll jank- // when browser chrome appears/disappears. The JS fix sets --vh-full from- // window.innerHeight on load, providing a stable value.+ // Use lvh (large viewport height) which is stable on Firefox iOS.+ // Firefox iOS incorrectly implements svh as dvh, causing scroll jank.// See: https://github.com/mozilla-mobile/firefox-ios/issues/11574- height: calc(var(--vh-full, 100svh) - var(--wt-header-height) - var(--safe-area-top, env(safe-area-inset-top, 0px))) !important;- max-height: calc(var(--vh-full, 100svh) - var(--wt-header-height) - var(--safe-area-top, env(safe-area-inset-top, 0px))) !important;+ height: calc(var(--vh-full, 100lvh) - var(--wt-header-height) - env(safe-area-inset-top, 0px)) !important;+ max-height: calc(var(--vh-full, 100lvh) - var(--wt-header-height) - env(safe-area-inset-top, 0px)) !important;padding: 4rem 40px 3rem;position: relative;display: flex;@@ -683,8 +680,8 @@ footer {}.hero-image {- // Use --vh-full (JS-set) with svh fallback for Firefox/Chrome iOS fix- max-height: calc(var(--vh-full, 100svh) * 0.55);+ // Use lvh which is stable on Firefox iOS (svh behaves like dvh there)+ max-height: calc(var(--vh-full, 100lvh) * 0.55);width: auto;aspect-ratio: 1;object-fit: contain;@@ -878,11 +875,11 @@ ul > li::marker {display: none;position: fixed;// Position below header (which may include safe-area-inset on iOS)- top: calc(var(--wt-header-height) + var(--safe-area-top, env(safe-area-inset-top, 0px)));+ top: calc(var(--wt-header-height) + env(safe-area-inset-top, 0px));left: 0;width: min(260px, 70vw);- // Use --vh-full (JS-set) with svh fallback for Firefox/Chrome iOS fix- height: calc(var(--vh-full, 100svh) - var(--wt-header-height) - var(--safe-area-top, env(safe-area-inset-top, 0px)));+ // Use lvh which is stable on Firefox iOS (svh behaves like dvh there)+ height: calc(var(--vh-full, 100lvh) - var(--wt-header-height) - env(safe-area-inset-top, 0px));background: var(--wt-color-bg-elevated);border-right: 1px solid var(--wt-color-border-subtle);z-index: 200;@@ -979,10 +976,10 @@ body.mobile-menu-open {header {// Height includes safe-area-inset so content isn't compressed- height: calc(var(--wt-header-height) + var(--safe-area-top, env(safe-area-inset-top, 0px)));+ height: calc(var(--wt-header-height) + env(safe-area-inset-top, 0px));padding: 10px 20px;// Push content below notch/Dynamic Island- padding-top: calc(var(--safe-area-top, env(safe-area-inset-top, 0px)) + 10px);+ padding-top: calc(env(safe-area-inset-top, 0px) + 10px);display: flex;flex-direction: row;align-items: center;@@ -1013,11 +1010,9 @@ body.mobile-menu-open {}.hero {- // TEST: Use auto height to avoid viewport-based sizing entirely- // This tests whether viewport calculations are causing Firefox iOS jank- height: auto !important;- min-height: 400px; // Minimum visual presence- max-height: none !important;+ // Use lvh (large viewport height) which should be stable on Firefox iOS+ // unlike svh which incorrectly behaves like dvh+ height: calc(var(--vh-full, 100lvh) - var(--wt-header-height) - env(safe-area-inset-top, 0px));padding: 2rem 20px;flex-direction: column;gap: 2rem;diff --git a/docs/templates/base.html b/docs/templates/base.htmlindex e53633f40..40da44768 100644--- a/docs/templates/base.html+++ b/docs/templates/base.html@@ -22,39 +22,11 @@// https://github.com/mozilla-mobile/firefox-ios/issues/11574(function() {var ua = navigator.userAgent;- // DEBUG: Apply to all iOS devices to test if fix works at all- // TODO: Restore FxiOS/CriOS detection after confirming fix works- if (!/iPhone|iPad|iPod/.test(ua)) return;-- var root = document.documentElement;- root.classList.add('ios-vh-lock'); // Debug: visible indicator-- function setLockedValues() {- // Lock viewport height- var h = (window.visualViewport && window.visualViewport.height) || window.innerHeight;- root.style.setProperty('--vh-full', Math.round(h) + 'px');-- // Lock safe-area-inset-top by reading computed value once- // env() values may fluctuate during toolbar animation on Firefox iOS- var testEl = document.createElement('div');- testEl.style.cssText = 'position:fixed;top:env(safe-area-inset-top,0px);visibility:hidden';- document.body.appendChild(testEl);- var safeTop = testEl.offsetTop;- document.body.removeChild(testEl);- root.style.setProperty('--safe-area-top', safeTop + 'px');-- console.log('[vh-lock] --vh-full=' + h + 'px, --safe-area-top=' + safeTop + 'px');- }-- // Set immediately (need to wait for body)- if (document.body) {- setLockedValues();- } else {- document.addEventListener('DOMContentLoaded', setLockedValues);+ if (/FxiOS/.test(ua) || /CriOS/.test(ua)) {+ // Capture initial viewport height (with browser chrome visible)+ // and use it as a stable value instead of broken svh+ document.documentElement.style.setProperty('--vh-full', window.innerHeight + 'px');}- // Re-set on bfcache restore and orientation change- window.addEventListener('pageshow', setLockedValues, { passive: true });- window.addEventListener('orientationchange', setLockedValues, { passive: true });})();</script><meta name="view-transition" content="same-origin">