fix(android): a dropdown raises no keyboard, so nothing should move
Focusing the Folder field made the screen jump: every .field-in was treated as if a keyboard were coming, reserving 60% of the height and lifting the row to the top of the panel. A <select> opens a native list over the page - it occupies nothing and vanishes on choice. And the lift threshold now says what the keyboard actually covers, a little under the bottom half. At 40% it raised fields that stayed perfectly visible, moving under the eye what was already fine.
This commit is contained in:
@@ -899,6 +899,12 @@ addEventListener('scroll', function (ev) {
|
||||
document.addEventListener('focusin', function (ev) {
|
||||
var el = ev.target;
|
||||
if (!el.classList || !el.classList.contains('field-in')) return;
|
||||
// UNE LISTE DEROULANTE NE LEVE PAS DE CLAVIER. Elle ouvre une liste native
|
||||
// par-dessus la page, qui n'occupe rien et disparait au choix. Lui reserver
|
||||
// 60 % de hauteur et la faire remonter en tete de panneau fait sauter
|
||||
// l'ecran sans qu'aucun clavier ne le justifie - c'est le champ Dossier qui
|
||||
// l'a montre.
|
||||
if (el.tagName === 'SELECT') return;
|
||||
document.body.classList.add('typing');
|
||||
// Differe d'un tour : la place reservee ci-dessus n'est pas encore prise en
|
||||
// compte, et il n'y aurait nulle part ou remonter.
|
||||
@@ -906,11 +912,12 @@ document.addEventListener('focusin', function (ev) {
|
||||
var row = el.closest && el.closest('.field, .in-wrap');
|
||||
var box = el.closest && el.closest('.scroll');
|
||||
if (!row || !box || !row.scrollIntoView) return;
|
||||
// NE BOUGER QUE SI C'EST UTILE. Un champ deja dans le haut du panneau -
|
||||
// celui des reglages, par exemple - est visible tel quel, et le faire
|
||||
// sauter quand meme ne fait que deplacer sous l'oeil ce qui allait bien.
|
||||
// NE BOUGER QUE SI C'EST UTILE, et le seuil doit dire ce que le clavier
|
||||
// recouvre : un peu moins de la moitie basse. A 40 % on faisait remonter
|
||||
// des champs qui restaient parfaitement visibles, donc on deplacait sous
|
||||
// l'oeil ce qui allait bien.
|
||||
var top = row.getBoundingClientRect().top - box.getBoundingClientRect().top;
|
||||
if (top > box.clientHeight * 0.4) row.scrollIntoView({ block: 'start' });
|
||||
if (top > box.clientHeight * 0.55) row.scrollIntoView({ block: 'start' });
|
||||
}, 250);
|
||||
});
|
||||
document.addEventListener('focusout', function () {
|
||||
|
||||
Reference in New Issue
Block a user