From fee07cc8b33dc41df3eb8751558efc1fbf920170 Mon Sep 17 00:00:00 2001 From: copy Date: Tue, 22 Nov 2016 16:44:44 +0100 Subject: [PATCH] Don't scroll when mobile keyboard is selected (#105) --- src/browser/main.js | 8 +++++++- v86.css | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/browser/main.js b/src/browser/main.js index 2660142d..4b4e2b1e 100644 --- a/src/browser/main.js +++ b/src/browser/main.js @@ -1103,7 +1103,13 @@ // allow text selection if(window.getSelection().isCollapsed) { - document.getElementsByClassName("phone_keyboard")[0].focus(); + let phone_keyboard = document.getElementsByClassName("phone_keyboard")[0]; + + // stop mobile browser from scrolling into view when the keyboard is shown + phone_keyboard.style.top = document.body.scrollTop + 100 + "px"; + phone_keyboard.style.left = document.body.scrollLeft + 100 + "px"; + + phone_keyboard.focus(); } } }; diff --git a/v86.css b/v86.css index 99d30c13..265d8576 100644 --- a/v86.css +++ b/v86.css @@ -64,6 +64,7 @@ a { resize: none; border: 0; padding: 0; + position: absolute; } h4 { margin: 0px 0px 20px 0px;