From 4ce9165f7791b12868a67481210d0ca567b7d6db Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Wed, 28 Oct 2020 16:07:12 +0100 Subject: [PATCH] js: Don't force focus in multipart updates if focus isn't affected --- public/js/icinga/loader.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/public/js/icinga/loader.js b/public/js/icinga/loader.js index 46e45f9d0..e146fc7c5 100644 --- a/public/js/icinga/loader.js +++ b/public/js/icinga/loader.js @@ -767,12 +767,20 @@ if (!! match) { var $target = $('#' + match[1]); if ($target.length) { + var forceFocus; + if (req.forceFocus + && typeof req.forceFocus.jquery !== 'undefined' + && $.contains($target[0], req.forceFocus[0]) + ) { + forceFocus = req.forceFocus; + } + _this.renderContentToContainer( match[2], $target, 'replace', req.autorefresh, - req.forceFocus, + forceFocus, autoSubmit, req.scripted );