Skip to content

Commit

Permalink
Fix event source for inputManager in case of multiple open dialogs
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrylyzo committed Jul 24, 2020
1 parent 0afe858 commit f292053
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/scripts/inputManager.js
Expand Up @@ -66,9 +66,12 @@ import appHost from 'apphost';
if (!sourceElement) {
sourceElement = document.activeElement || window;

const dlg = document.querySelector('.dialogContainer .dialog.opened');
const dialogs = document.querySelectorAll('.dialogContainer .dialog.opened');

if (dlg && (!sourceElement || !dlg.contains(sourceElement))) {
// Suppose the top open dialog is active
const dlg = dialogs.length ? dialogs[dialogs.length - 1] : null;

if (dlg && !dlg.contains(sourceElement)) {
sourceElement = dlg;
}
}
Expand Down

0 comments on commit f292053

Please sign in to comment.