From 4d6f187aee013a377e79754ef8f32cdb71558cb5 Mon Sep 17 00:00:00 2001 From: Dmitry Lyzo Date: Sat, 14 Mar 2020 22:29:58 +0300 Subject: [PATCH] Fix event source for inputManager --- src/scripts/inputManager.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/scripts/inputManager.js b/src/scripts/inputManager.js index 772f13b8c7..4d62ff9f20 100644 --- a/src/scripts/inputManager.js +++ b/src/scripts/inputManager.js @@ -58,7 +58,15 @@ define(['playbackManager', 'focusManager', 'appRouter', 'dom', 'apphost'], funct sourceElement = focusManager.focusableParent(sourceElement); } - sourceElement = sourceElement || document.querySelector('.dialogContainer .dialog.opened') || document.activeElement || window; + if (!sourceElement) { + sourceElement = document.activeElement || window; + + var dlg = document.querySelector('.dialogContainer .dialog.opened'); + + if (dlg && (!sourceElement || !dlg.contains(sourceElement))) { + sourceElement = dlg; + } + } if (eventListenerCount) { var customEvent = new CustomEvent("command", {