fix(mobile): scale keyboard lift by measured 0.52 (plugin over-reports ~2x)
Measured from device screenshot: composer at ~678pt from bottom vs 351pt keyboard = 2x overshoot. Scale the reported height by 0.52 so the composer sits flush on the keyboard. Single tunable const. Build marker -> 2026-07-18-batch103. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1112,7 +1112,7 @@
|
||||
</head>
|
||||
<body>
|
||||
<script src="/icons.js?v=6"></script>
|
||||
<script>window.__BUILD='2026-07-18-batch102';console.log('%cBiz Connect','color:#1F3B73;font-weight:bold','build '+window.__BUILD);
|
||||
<script>window.__BUILD='2026-07-18-batch103';console.log('%cBiz Connect','color:#1F3B73;font-weight:bold','build '+window.__BUILD);
|
||||
// Emoji are rendered with the OS's own (colour) emoji font — instant, zero network.
|
||||
//
|
||||
// We used to run Twemoji over every emoji, which swapped each one for an <img> pulled INDIVIDUALLY from
|
||||
@@ -1131,7 +1131,10 @@ function twemojify(_el){ /* native emoji: nothing to do */ }</script>
|
||||
// The plugin reports that height in DEVICE PIXELS on some builds, but CSS wants points — so a raw value
|
||||
// bigger than the screen's point height is divided by devicePixelRatio. This normalization makes it land
|
||||
// exactly on the keyboard regardless of unit.
|
||||
function bzKbHeight(raw){ raw=raw||0; var dpr=window.devicePixelRatio||1; return Math.round(raw > window.innerHeight ? raw/dpr : raw); }
|
||||
// Measured on-device: the plugin's reported height puts the composer ~2x too high, so scale it. This is
|
||||
// a single tunable number — if the composer isn't flush on the keyboard, nudge KB_FACTOR up/down.
|
||||
var KB_FACTOR=0.52;
|
||||
function bzKbHeight(raw){ raw=raw||0; var dpr=window.devicePixelRatio||1; var norm = raw > window.innerHeight ? raw/dpr : raw; return Math.round(norm*KB_FACTOR); }
|
||||
var KB=C.Plugins&&C.Plugins.Keyboard;
|
||||
if(KB && KB.addListener){
|
||||
KB.addListener('keyboardWillShow', function(info){ var h=bzKbHeight(info&&info.keyboardHeight); r.style.setProperty('--kb', h+'px'); document.body.classList.add('kb-open'); var b=document.getElementById('msgs'); if(b) requestAnimationFrame(function(){ b.scrollTop=b.scrollHeight; }); });
|
||||
|
||||
Reference in New Issue
Block a user