Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
Fix iOS viewport height with -webkit-fill-available and improve polyfill
Maximilian Roos71cc12fff968
diff --git a/docs/sass/custom.scss b/docs/sass/custom.scssindex 3fdbc8c07..2a536db0c 100644--- a/docs/sass/custom.scss+++ b/docs/sass/custom.scss@@ -9,6 +9,8 @@ html {// Reserve scrollbar space to prevent layout shift when navigating// Browser support: Safari 17+, Chrome 94+, Firefox 97+. Graceful degradation.scrollbar-gutter: stable;+ // Enable -webkit-fill-available to work correctly for child elements on iOS+ height: -webkit-fill-available;}// ============================================================================@@ -131,6 +133,24 @@ header {z-index: 200;pointer-events: none;}++ // iOS WebKit viewport height fix: -webkit-fill-available is stable+ // against browser chrome animation, unlike svh/lvh which may jank on+ // Firefox iOS and Chrome iOS due to missing WebKit viewport inset APIs.+ // See: https://github.com/mozilla-mobile/firefox-ios/issues/11574+ body {+ min-height: -webkit-fill-available;+ }++ .hero {+ // Use string interpolation to bypass SCSS calc() parsing+ height: #{"calc(-webkit-fill-available - var(--wt-header-height) - env(safe-area-inset-top, 0px))"} !important;+ max-height: #{"calc(-webkit-fill-available - var(--wt-header-height) - env(safe-area-inset-top, 0px))"} !important;+ }++ .mobile-menu {+ height: #{"calc(-webkit-fill-available - var(--wt-header-height) - env(safe-area-inset-top, 0px))"};+ }}.logo {diff --git a/docs/templates/base.html b/docs/templates/base.htmlindex 40da44768..53cd9a546 100644--- a/docs/templates/base.html+++ b/docs/templates/base.html@@ -16,16 +16,46 @@{# _variables.html is already included by the theme at line 12 of juice/templates/index.html #}{# Zola resolves it to our custom templates/_variables.html, so no need to include it again #}<script>-// Firefox iOS/Chrome iOS viewport fix: svh incorrectly behaves like dvh-// causing scroll jank when browser chrome appears/disappears.-// Root cause: Missing minimumViewportInset/maximumViewportInset WebKit APIs-// https://github.com/mozilla-mobile/firefox-ios/issues/11574+// iOS viewport height polyfill: svh/lvh are broken on Firefox iOS and Chrome iOS+// due to missing minimumViewportInset/maximumViewportInset WebKit APIs.+// This sets a stable --vh-full CSS variable by tracking the minimum viewport height.+// See: https://github.com/mozilla-mobile/firefox-ios/issues/11574(function() {- var ua = navigator.userAgent;- 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');+ // Only run on iOS WebKit browsers (Safari, Chrome iOS, Firefox iOS, in-app webviews)+ var isIOS = /iP(hone|ad|od)/.test(navigator.platform) ||+ (/Macintosh/.test(navigator.userAgent) && 'ontouchend' in document);+ if (!isIOS) return;++ var raf, lastHeight;++ function setViewportHeight() {+ // Use the smallest of available height measurements to approximate "small viewport"+ var c1 = window.innerHeight;+ var c2 = document.documentElement.clientHeight;+ var c3 = (window.visualViewport && window.visualViewport.height) || c1;+ var h = Math.min(c1 || Infinity, c2 || Infinity, c3 || Infinity);+ if (h && h !== lastHeight) {+ lastHeight = h;+ document.documentElement.style.setProperty('--vh-full', h + 'px');+ }+ }++ function schedule() {+ if (raf) return;+ raf = requestAnimationFrame(function() {+ raf = null;+ setViewportHeight();+ });+ }++ // Set initial value immediately+ setViewportHeight();++ // Update on relevant events (passive for performance)+ window.addEventListener('resize', schedule, { passive: true });+ window.addEventListener('orientationchange', schedule, { passive: true });+ if (window.visualViewport) {+ window.visualViewport.addEventListener('resize', schedule, { passive: true });}})();</script>