chore(android): make the page say what it measures about the keyboard

Two fixes placed by reasoning changed nothing observable, which means the
reasoning was wrong somewhere I cannot see from here. This writes the
numbers into the log rather than a fleeting message, so they can be read
after the fact: the window height, the visible height, and - the one that
settles it - what the scroll box shows against what it contains. Equal, and
there is nothing to scroll, which would be the whole problem.

Temporary. It comes out once the cause is known.
This commit is contained in:
r-zakarya
2026-08-21 15:21:10 +01:00
parent bde22d2288
commit 79a6625613
+27
View File
@@ -695,11 +695,38 @@ if (window.visualViewport) {
var measureKeyboard = function () { var measureKeyboard = function () {
var hidden = Math.max(0, Math.round(window.innerHeight - vv.height)); var hidden = Math.max(0, Math.round(window.innerHeight - vv.height));
document.documentElement.style.setProperty('--kb', hidden + 'px'); document.documentElement.style.setProperty('--kb', hidden + 'px');
reportBox('keyboard');
}; };
vv.addEventListener('resize', measureKeyboard); vv.addEventListener('resize', measureKeyboard);
measureKeyboard(); measureKeyboard();
} else {
window._noVisualViewport = true;
} }
// DIAGNOSTIC, temporaire. Deux corrections posees a l'aveugle n'ont rien
// change ; celle-ci dit ce que la page mesure vraiment, dans le journal plutot
// qu'en message fugace, pour qu'on puisse la lire apres coup.
function reportBox(why) {
// PM n'existe pas encore au chargement : cette fonction tourne aussi avant
// lui, et on ne va pas casser la page pour une trace.
// Les trois vues sont TOUTES dans le document - c'est un rail, rien n'est
// masque - donc la vue active se designe par son nom, pas par sa visibilite.
if (!window.PM || !PM.log) return;
var box = document.getElementById(view);
box = box && box.querySelector('.scroll');
var vh = window.visualViewport ? Math.round(window.visualViewport.height) : -1;
var sc = document.body.className || '(none)';
if (!box) { PM.log(why + ': no scroll box, body=' + sc); return; }
// clientHeight = ce que la boite montre, scrollHeight = ce qu'elle contient.
// Egaux, il n'y a rien a faire defiler, et c'est TOUT le probleme.
PM.log(why + ': inner ' + window.innerHeight + ' visual ' + vh
+ ' | box client ' + box.clientHeight + ' scroll ' + box.scrollHeight
+ ' | body=' + sc);
}
document.addEventListener('focusin', function () {
setTimeout(function () { reportBox('focus'); }, 400);
});
// AUCUN CHAMP D'UNE VUE AU REPOS NE GARDE LE FOCUS. // AUCUN CHAMP D'UNE VUE AU REPOS NE GARDE LE FOCUS.
// //
// Meme origine que le glissement ci-dessus. La touche de validation du clavier // Meme origine que le glissement ci-dessus. La touche de validation du clavier