mirror of
https://github.com/overte-org/overte.git
synced 2025-04-14 15:47:02 +02:00
don't trigger virtual keyboard scroll on non input focus.
This commit is contained in:
parent
b72f462028
commit
84e8e21d85
1 changed files with 8 additions and 4 deletions
|
@ -18,7 +18,7 @@
|
||||||
window.isKeyboardRaised = false;
|
window.isKeyboardRaised = false;
|
||||||
window.isNumericKeyboard = false;
|
window.isNumericKeyboard = false;
|
||||||
window.isPasswordField = false;
|
window.isPasswordField = false;
|
||||||
window.lastActiveElement = null;
|
window.lastActiveInputElement = null;
|
||||||
|
|
||||||
function getActiveElement() {
|
function getActiveElement() {
|
||||||
return document.activeElement;
|
return document.activeElement;
|
||||||
|
@ -70,11 +70,15 @@
|
||||||
var keyboardRaised = shouldRaiseKeyboard();
|
var keyboardRaised = shouldRaiseKeyboard();
|
||||||
var numericKeyboard = shouldSetNumeric();
|
var numericKeyboard = shouldSetNumeric();
|
||||||
var passwordField = shouldSetPasswordField();
|
var passwordField = shouldSetPasswordField();
|
||||||
var activeElement = getActiveElement();
|
var activeInputElement = null;
|
||||||
|
// Only set the active input element when there is an input element focussed, otherwise it will scroll on body focus as well.
|
||||||
|
if (keyboardRaised) {
|
||||||
|
activeInputElement = getActiveElement();
|
||||||
|
}
|
||||||
|
|
||||||
if (isWindowFocused &&
|
if (isWindowFocused &&
|
||||||
(keyboardRaised !== window.isKeyboardRaised || numericKeyboard !== window.isNumericKeyboard
|
(keyboardRaised !== window.isKeyboardRaised || numericKeyboard !== window.isNumericKeyboard
|
||||||
|| passwordField !== window.isPasswordField || activeElement !== window.lastActiveElement)) {
|
|| passwordField !== window.isPasswordField || activeInputElement !== window.lastActiveInputElement)) {
|
||||||
|
|
||||||
if (typeof EventBridge !== "undefined" && EventBridge !== null) {
|
if (typeof EventBridge !== "undefined" && EventBridge !== null) {
|
||||||
EventBridge.emitWebEvent(
|
EventBridge.emitWebEvent(
|
||||||
|
@ -96,7 +100,7 @@
|
||||||
window.isKeyboardRaised = keyboardRaised;
|
window.isKeyboardRaised = keyboardRaised;
|
||||||
window.isNumericKeyboard = numericKeyboard;
|
window.isNumericKeyboard = numericKeyboard;
|
||||||
window.isPasswordField = passwordField;
|
window.isPasswordField = passwordField;
|
||||||
window.lastActiveElement = activeElement;
|
window.lastActiveInputElement = activeInputElement;
|
||||||
}
|
}
|
||||||
}, POLL_FREQUENCY);
|
}, POLL_FREQUENCY);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue