Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

Revert "Remove iOS viewport polyfill and use 100lvh directly"

Maximilian Roos2da14c166ee1
diff --git a/docs/sass/custom.scss b/docs/sass/custom.scss
index a141644a4..3fdbc8c07 100644
--- a/docs/sass/custom.scss
+++ b/docs/sass/custom.scss
@@ -23,7 +23,7 @@ body {
background-color: var(--wt-color-bg);
// 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: 100lvh;
+ min-height: var(--vh-full, 100lvh);
}
// Override Juice theme's .text class (sets font-size: 18px, we want 15px)
@@ -521,7 +521,7 @@ table {
border-top: 3px solid var(--wt-color-accent);
padding: 0.75rem 0 1rem;
// Use lvh which is stable on Firefox iOS (svh behaves like dvh there)
- max-height: calc(100lvh - var(--wt-header-height) - var(--wt-main-padding-top) - 20px);
+ 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
}
@@ -663,8 +663,8 @@ footer {
// 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(100lvh - var(--wt-header-height) - env(safe-area-inset-top, 0px)) !important;
- max-height: calc(100lvh - var(--wt-header-height) - 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;
@@ -681,7 +681,7 @@ footer {
.hero-image {
// Use lvh which is stable on Firefox iOS (svh behaves like dvh there)
- max-height: calc(100lvh * 0.55);
+ max-height: calc(var(--vh-full, 100lvh) * 0.55);
width: auto;
aspect-ratio: 1;
object-fit: contain;
@@ -879,7 +879,7 @@ ul > li::marker {
left: 0;
width: min(260px, 70vw);
// Use lvh which is stable on Firefox iOS (svh behaves like dvh there)
- height: calc(100lvh - var(--wt-header-height) - env(safe-area-inset-top, 0px));
+ 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;
@@ -1012,7 +1012,7 @@ body.mobile-menu-open {
.hero {
// Use lvh (large viewport height) which should be stable on Firefox iOS
// unlike svh which incorrectly behaves like dvh
- height: calc(100lvh - var(--wt-header-height) - env(safe-area-inset-top, 0px));
+ 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.html
index 17cb5ce31..0944b74db 100644
--- a/docs/templates/base.html
+++ b/docs/templates/base.html
@@ -15,7 +15,37 @@
{% block head %}
{# _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 #}
-<!-- iOS viewport fix disabled for testing - see if jank persists without it -->
+<script>
+// iOS viewport height fix: Capture a STABLE height once on page load.
+// Do NOT update on resize/scroll - that's what causes the jank!
+// On Firefox iOS and Chrome iOS, svh/lvh behave like dvh due to missing
+// minimumViewportInset/maximumViewportInset WebKit APIs.
+// See: https://github.com/mozilla-mobile/firefox-ios/issues/11574
+(function() {
+ // Only run on iOS WebKit browsers
+ var isIOS = /iP(hone|ad|od)/.test(navigator.platform) ||
+ (/Macintosh/.test(navigator.userAgent) && 'ontouchend' in document);
+ if (!isIOS) return;
+
+ // Capture initial viewport height ONCE (with browser chrome visible)
+ // and use it as a stable value. Never update on resize.
+ var h = window.innerHeight;
+ if (h) {
+ document.documentElement.style.setProperty('--vh-full', h + 'px');
+ }
+
+ // Only update on orientation change (actual device rotation)
+ window.addEventListener('orientationchange', function() {
+ // Small delay to let the new orientation settle
+ setTimeout(function() {
+ var newH = window.innerHeight;
+ if (newH) {
+ document.documentElement.style.setProperty('--vh-full', newH + 'px');
+ }
+ }, 100);
+ });
+})();
+</script>
<meta name="view-transition" content="same-origin">
<meta name="description" content="{{ config.extra.site_description }}">