diff --git a/public/js/icinga/events.js b/public/js/icinga/events.js index 9ce20adb0..93abc7820 100644 --- a/public/js/icinga/events.js +++ b/public/js/icinga/events.js @@ -387,7 +387,7 @@ } var req = icinga.loader.loadUrl(url, $target, data, method); - req.forceFocus = autosubmit ? $(event.currentTarget) : null; + req.forceFocus = autosubmit ? $(event.currentTarget) : $button.length ? $button : null; req.progressTimer = progressTimer; event.stopPropagation(); diff --git a/public/js/icinga/loader.js b/public/js/icinga/loader.js index fd934764f..78bdee93a 100644 --- a/public/js/icinga/loader.js +++ b/public/js/icinga/loader.js @@ -331,7 +331,7 @@ } } - this.redirectToUrl(redirect, req.$target, req.url, req.getResponseHeader('X-Icinga-Rerender-Layout')); + this.redirectToUrl(redirect, req.$target, req.url, req.getResponseHeader('X-Icinga-Rerender-Layout'), req.forceFocus); return true; }, @@ -340,10 +340,10 @@ * * @param {string} url * @param {object} $target - * @param {string] origin + * @param {string} origin * @param {boolean} rerenderLayout */ - redirectToUrl: function (url, $target, origin, rerenderLayout) { + redirectToUrl: function (url, $target, origin, rerenderLayout, forceFocus) { var icinga = this.icinga; if (typeof rerenderLayout === 'undefined') { @@ -392,7 +392,8 @@ } } - this.loadUrl(url, $target); + var req = this.loadUrl(url, $target); + req.forceFocus = url === origin ? forceFocus : null; } } },