Skip to content

Commit d902b5f

Browse files
committed
Update console-sheet.js
1 parent 65c9729 commit d902b5f

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

live-view/extensions/mobile-console/console-sheet.js

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -666,10 +666,14 @@ class ConsoleSheet {
666666

667667
if (!isSafari) {
668668

669+
let lastInputFocusTime = 0;
670+
669671
input.on('focus', () => {
670672

671673
navigator.virtualKeyboard.overlaysContent = true;
672674

675+
lastInputFocusTime = new Date().getTime();
676+
673677
});
674678

675679
input.on('blur', () => {
@@ -693,21 +697,14 @@ class ConsoleSheet {
693697

694698
// prevent soft-hiding keyboard on Android
695699

700+
const currTime = new Date().getTime();
701+
const inputFocusTimeDelta = currTime - lastInputFocusTime;
702+
696703
if (document.activeElement === input &&
704+
inputFocusTimeDelta !== 0 &&
697705
keyboardHeight === 0) {
698706

699-
onNextFrame(() => {
700-
701-
keyboardHeight = navigator.virtualKeyboard.boundingRect.height;
702-
703-
if (document.activeElement === input &&
704-
keyboardHeight === 0) {
705-
706-
input.blur();
707-
708-
}
709-
710-
});
707+
input.blur();
711708

712709
}
713710

0 commit comments

Comments
 (0)