mirror of
https://github.com/overte-org/overte.git
synced 2025-04-22 19:53:29 +02:00
Fix keyboard state in browser when switching focus to/from dialog frame
This commit is contained in:
parent
64c54f9c6b
commit
8f42a3fe9e
3 changed files with 13 additions and 8 deletions
interface/resources
|
@ -11,6 +11,7 @@
|
|||
var POLL_FREQUENCY = 500; // ms
|
||||
var MAX_WARNINGS = 3;
|
||||
var numWarnings = 0;
|
||||
var isWindowFocused = true;
|
||||
var isKeyboardRaised = false;
|
||||
var isNumericKeyboard = false;
|
||||
var KEYBOARD_HEIGHT = 200;
|
||||
|
@ -38,7 +39,7 @@
|
|||
var keyboardRaised = shouldRaiseKeyboard();
|
||||
var numericKeyboard = shouldSetNumeric();
|
||||
|
||||
if (keyboardRaised !== isKeyboardRaised || numericKeyboard !== isNumericKeyboard) {
|
||||
if (isWindowFocused && (keyboardRaised !== isKeyboardRaised || numericKeyboard !== isNumericKeyboard)) {
|
||||
|
||||
if (typeof EventBridge !== "undefined" && EventBridge !== null) {
|
||||
EventBridge.emitWebEvent(
|
||||
|
@ -65,4 +66,14 @@
|
|||
isNumericKeyboard = numericKeyboard;
|
||||
}
|
||||
}, POLL_FREQUENCY);
|
||||
|
||||
window.addEventListener("focus", function () {
|
||||
isWindowFocused = true;
|
||||
});
|
||||
|
||||
window.addEventListener("blur", function () {
|
||||
isWindowFocused = false;
|
||||
isKeyboardRaised = false;
|
||||
isNumericKeyboard = false;
|
||||
});
|
||||
})();
|
||||
|
|
|
@ -31,13 +31,6 @@ ScrollingWindow {
|
|||
addressBar.text = webview.url
|
||||
}
|
||||
|
||||
onParentChanged: {
|
||||
if (visible) {
|
||||
addressBar.forceActiveFocus();
|
||||
addressBar.selectAll()
|
||||
}
|
||||
}
|
||||
|
||||
function showPermissionsBar(){
|
||||
permissionsContainer.visible=true;
|
||||
}
|
||||
|
|
|
@ -16,5 +16,6 @@ BaseWebView {
|
|||
// Load dialog via OffscreenUi so that JavaScript EventBridge is available.
|
||||
var browser = OffscreenUi.load("Browser.qml");
|
||||
request.openIn(browser.webView);
|
||||
browser.webView.forceActiveFocus();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue