diff --git a/server/public/home.html b/server/public/home.html index da59915..eeb631f 100644 --- a/server/public/home.html +++ b/server/public/home.html @@ -1343,15 +1343,21 @@ function twemojify(_el){ /* native emoji: nothing to do */ } var KB=C.Plugins&&C.Plugins.Keyboard; if(p==='ios' && KB && KB.setAccessoryBarVisible){ try{ KB.setAccessoryBarVisible({ isVisible:false }); }catch(_){} } // hide the grey iOS input accessory bar (up/down chevrons + Done) above the keyboard — iOS-only, no-op elsewhere if(KB && KB.addListener){ - KB.addListener('keyboardWillShow', function(info){ var raw=(info&&info.keyboardHeight)||0; var kb = raw>window.innerHeight ? raw/(window.devicePixelRatio||1) : raw; setKb(kb); }); - KB.addListener('keyboardWillHide', function(){ setKb(0); }); - KB.addListener('keyboardDidHide', function(){ setKb(0); }); // belt-and-suspenders: some close paths only fire Did* - // TEMP kbdiag (remove after diagnosing the Android repeat-open gap): logs the metrics that tell us whether - // the WebView resizes (interactive-widget) vs relies on --kb, and any residual across open #1 vs #2. - var _kbn=0, _cs=function(){ return getComputedStyle(document.documentElement).getPropertyValue('--kb').trim(); }; - KB.addListener('keyboardWillShow', function(info){ _kbn++; console.log('[kbdiag] willShow#'+_kbn+' kbH='+((info&&info.keyboardHeight)||0)+' innerH='+window.innerHeight+' clientH='+document.documentElement.clientHeight+' vvH='+(window.visualViewport?Math.round(window.visualViewport.height):'-')+' preKb='+_cs()); }); - if(KB.addListener){ KB.addListener('keyboardDidShow', function(info){ console.log('[kbdiag] didShow kbH='+((info&&info.keyboardHeight)||0)+' innerH='+window.innerHeight+' clientH='+document.documentElement.clientHeight+' vvH='+(window.visualViewport?Math.round(window.visualViewport.height):'-')+' curKb='+_cs()+' kbOpen='+document.body.classList.contains('kb-open')); }); } - KB.addListener('keyboardDidHide', function(){ console.log('[kbdiag] didHide innerH='+window.innerHeight+' clientH='+document.documentElement.clientHeight+' vvH='+(window.visualViewport?Math.round(window.visualViewport.height):'-')+' curKb='+_cs()); }); + if(p==='ios'){ + // iOS WKWebView does NOT resize for the keyboard (it ignores interactive-widget) → lift the composer + // manually by the reported keyboard height. + KB.addListener('keyboardWillShow', function(info){ var raw=(info&&info.keyboardHeight)||0; var kb = raw>window.innerHeight ? raw/(window.devicePixelRatio||1) : raw; setKb(kb); }); + KB.addListener('keyboardWillHide', function(){ setKb(0); }); + KB.addListener('keyboardDidHide', function(){ setKb(0); }); // belt-and-suspenders: some close paths only fire Did* + } else { + // Android: interactive-widget=resizes-content already SHRINKS the layout viewport to sit above the keyboard + // (device log: innerHeight 800→472 for a 328px keyboard), so the composer is already positioned. Applying + // the --kb lift too DOUBLED it → a keyboard-height white gap. Keep --kb=0 here; only toggle kb-open so --sab + // (nav-bar inset) collapses and the composer sits flush to the keyboard. + KB.addListener('keyboardWillShow', function(){ r.style.setProperty('--kb','0px'); document.body.classList.add('kb-open'); var b=document.getElementById('msgs'); if(b && (b.scrollHeight-b.scrollTop-b.clientHeight)<400) b.scrollTop=b.scrollHeight; }); + KB.addListener('keyboardWillHide', function(){ r.style.setProperty('--kb','0px'); document.body.classList.remove('kb-open'); }); + KB.addListener('keyboardDidHide', function(){ document.body.classList.remove('kb-open'); }); + } } }catch(_){} })(); // Browser / iOS home-screen PWA (NO Capacitor Keyboard plugin): lift the composer above the on-screen