js: Improve rejection of autorefresh responses

Don't reject autorefreshes if an autosubmit
element is focused but not interacted with

fixes #4996
This commit is contained in:
Johannes Meyer 2024-02-06 10:59:20 +01:00
parent a48a6ebcb5
commit 6964bd19a2
1 changed files with 7 additions and 7 deletions

View File

@ -78,13 +78,13 @@
return null;
}
var origFocus = document.activeElement;
var containerId = $container.attr('id');
if ($container.has(origFocus).length
&& $(origFocus).length
&& ! $(origFocus).hasClass('autofocus')
&& $(origFocus).closest('form').length
&& $(origFocus).not(':input[type=button], :input[type=submit], :input[type=reset]').length
const origFocus = document.activeElement;
const containerId = $container.attr('id');
if ($container[0].contains(origFocus)
&& origFocus.form
&& ! origFocus.matches(
'input[type=submit], input[type=reset], input[type=button], .autofocus, .autosubmit:not(:hover)'
)
) {
this.icinga.logger.debug('Not changing content for ' + containerId + ' form has focus');
return null;