From 6ef51c01d07f604f080e68abe9bfd56f6fba949a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 7 Mar 2026 11:34:24 +0000 Subject: [PATCH] fix: address code review - restore zoom accessibility, use CSS var for viewport height, debounce resize Co-authored-by: qinfendebingshuo <207279273+qinfendebingshuo@users.noreply.github.com> --- docs/index.html | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/docs/index.html b/docs/index.html index 0444e975..e966da1b 100644 --- a/docs/index.html +++ b/docs/index.html @@ -3,7 +3,7 @@
- + @@ -47,7 +47,7 @@ html,body{height:100%;background:var(--bg);color:var(--text);font-family:-apple- #id-preview{display:none;text-align:center;margin-bottom:10px;padding:10px;background:var(--s3);border-radius:8px;font-size:14px;font-weight:600} /* ─── APP SHELL (three-column) ─── */ -#app{display:none;height:100vh;height:100dvh;width:100%;overflow:hidden} +#app{display:none;height:100vh;height:100dvh;height:var(--vh,100dvh);width:100%;overflow:hidden} #app.on{display:flex;flex-direction:column} /* ─── LEFT SIDEBAR ─── */ @@ -2106,14 +2106,18 @@ window.addEventListener('resize', function(){ // MOBILE: VIEWPORT HEIGHT FIX & KEYBOARD HANDLER // ═══════════════════════════════════════════════════════ (function(){ - // Fix iOS/Android virtual keyboard pushing content + // Fix iOS/Android virtual keyboard pushing content via CSS custom property if(window.visualViewport){ - var appEl=document.getElementById('app'); + var raf=0; window.visualViewport.addEventListener('resize',function(){ - if(appEl && appEl.classList.contains('on')){ - appEl.style.height=window.visualViewport.height+'px'; - scrollB(); - } + cancelAnimationFrame(raf); + raf=requestAnimationFrame(function(){ + var appEl=document.getElementById('app'); + if(appEl && appEl.classList.contains('on')){ + appEl.style.setProperty('--vh',window.visualViewport.height+'px'); + scrollB(); + } + }); }); } // Close sidebar on any outside tap (mobile)