From ad5d525340756a624e6f67ffa6f9ccb59fc78a83 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Fri, 30 Sep 2016 14:13:35 +1300 Subject: [PATCH] Fix keyboard status when switching between entities editor tabs --- scripts/system/html/js/keyboardControl.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/system/html/js/keyboardControl.js b/scripts/system/html/js/keyboardControl.js index 291330e8de..964f5f5786 100644 --- a/scripts/system/html/js/keyboardControl.js +++ b/scripts/system/html/js/keyboardControl.js @@ -47,10 +47,21 @@ function setUpKeyboardControl() { } } + function documentBlur() { + // Action any pending Lower keyboard event immediately upon leaving document window so that they don't interfere with + // other Entities Editor tab. + if (lowerTimer !== null) { + clearTimeout(lowerTimer); + doLowerKeyboard(); + } + } + var inputs = document.querySelectorAll("input[type=text], input[type=number], textarea"); for (var i = 0, length = inputs.length; i < length; i++) { inputs[i].addEventListener("focus", raiseKeyboard); inputs[i].addEventListener("blur", lowerKeyboard); } + + window.addEventListener("blur", documentBlur); }