Api: Find the current focused object from global instead of app object when handling key presses

Should better handle apps admin where the focused object could be from a different app
This commit is contained in:
nathangray 2020-05-20 10:31:32 -06:00
parent 6a425ac935
commit 3626679408

View File

@ -267,10 +267,11 @@ function egw_keyHandler(_keyCode, _shift, _ctrl, _alt) {
// Get the object manager and fetch the container of the currently // Get the object manager and fetch the container of the currently
// focused object // focused object
var focusedObject = egw_globalObjectManager.getFocusedObject();
var appMgr = egw_getAppObjectManager(false); var appMgr = egw_getAppObjectManager(false);
if (appMgr) if (appMgr && !focusedObject)
{ {
var focusedObject = appMgr.getFocusedObject(); focusedObject = appMgr.getFocusedObject();
if (!focusedObject) if (!focusedObject)
{ {
@ -296,10 +297,9 @@ function egw_keyHandler(_keyCode, _shift, _ctrl, _alt) {
focusedObject = cntr.children[0]; focusedObject = cntr.children[0];
} }
} }
}
if (focusedObject) if (focusedObject)
{ {
// Handle the default keys (arrow_up, down etc.) // Handle the default keys (arrow_up, down etc.)
var cntr = focusedObject.getContainerRoot(); var cntr = focusedObject.getContainerRoot();
var handled = false; var handled = false;
@ -310,7 +310,8 @@ function egw_keyHandler(_keyCode, _shift, _ctrl, _alt) {
} }
// Execute the egw_popup key handler of the focused object // Execute the egw_popup key handler of the focused object
if (!handled) { if (!handled)
{
return focusedObject.executeActionImplementation( return focusedObject.executeActionImplementation(
{ {
"keyEvent": { "keyEvent": {
@ -324,7 +325,6 @@ function egw_keyHandler(_keyCode, _shift, _ctrl, _alt) {
return handled; return handled;
} }
}
return false; return false;
} }