From 698ac5812fb97d7b3a63a26a986e7806a9b277c0 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Tue, 2 Nov 2021 16:24:13 +0100 Subject: [PATCH] loader.js: Don't scroll to nav anchors that don't want this --- public/js/icinga/loader.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/public/js/icinga/loader.js b/public/js/icinga/loader.js index e009feab9..85adcdf4c 100644 --- a/public/js/icinga/loader.js +++ b/public/js/icinga/loader.js @@ -1298,7 +1298,12 @@ this.icinga.ui.assignUniqueContainerIds(); if (! discard && navigationAnchor) { - setTimeout(this.icinga.ui.focusElement.bind(this.icinga.ui), 0, navigationAnchor, $container); + var $element = $container.find('#' + navigationAnchor); + if ($element.length) { + // data-icinga-no-scroll-on-focus is NOT designed to avoid scrolling for non-XHR requests + setTimeout(this.icinga.ui.focusElement.bind(this.icinga.ui), 0, + $element, $container, ! $element.is('[data-icinga-no-scroll-on-focus]')); + } } else if (! activeElementPath) { // Active element was not in this container if (! autorefresh && ! autoSubmit && ! scripted) {