mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-29 16:54:04 +02:00
Add more sophisticated fix for keeping the focus after an autorefresh
fixes #8350
This commit is contained in:
parent
ea57e7a786
commit
3dce0e434a
@ -675,7 +675,6 @@
|
|||||||
// Container update happens here
|
// Container update happens here
|
||||||
var scrollPos = false;
|
var scrollPos = false;
|
||||||
var self = this;
|
var self = this;
|
||||||
var origFocus = self.icinga.utils.getDomPath(document.activeElement);
|
|
||||||
var containerId = $container.attr('id');
|
var containerId = $container.attr('id');
|
||||||
if (typeof containerId !== 'undefined') {
|
if (typeof containerId !== 'undefined') {
|
||||||
if (autorefresh) {
|
if (autorefresh) {
|
||||||
@ -684,6 +683,9 @@
|
|||||||
scrollPos = 0;
|
scrollPos = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (autorefresh && $.contains($container[0], document.activeElement)) {
|
||||||
|
var origFocus = self.icinga.utils.getDomPath(document.activeElement);
|
||||||
|
}
|
||||||
|
|
||||||
$container.trigger('beforerender');
|
$container.trigger('beforerender');
|
||||||
|
|
||||||
@ -740,7 +742,7 @@
|
|||||||
}
|
}
|
||||||
this.icinga.ui.assignUniqueContainerIds();
|
this.icinga.ui.assignUniqueContainerIds();
|
||||||
|
|
||||||
if (origFocus.length == origFocus[0] !== '') {
|
if (origFocus && origFocus.length > 0 && origFocus[0] !== '') {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$(self.icinga.utils.getElementByDomPath(origFocus)).focus();
|
$(self.icinga.utils.getElementByDomPath(origFocus)).focus();
|
||||||
}, 0);
|
}, 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user