From ab152757e8166b166fe661697ba057649030a791 Mon Sep 17 00:00:00 2001 From: Sukhwinder Dhillon Date: Mon, 29 Jul 2024 12:16:09 +0200 Subject: [PATCH] ActionList: Take items with css propery `display:contents` into account For example, the elements of icingadb/hostgroup are `display:contents`, which leads to scrollIntoView() having no effect. --- asset/js/widget/ActionList.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/asset/js/widget/ActionList.js b/asset/js/widget/ActionList.js index 137be7a5..5db19590 100644 --- a/asset/js/widget/ActionList.js +++ b/asset/js/widget/ActionList.js @@ -14,6 +14,8 @@ define(["../notjQuery"], function ($) { this.lastActivatedItemUrl = null; this.lastTimeoutId = null; this.processing = false; + + this.isDisplayContents = null; } bind() { @@ -402,6 +404,19 @@ define(["../notjQuery"], function ($) { * @param pressedKey Pressed key (`ArrowUp` or `ArrowDown`) */ scrollItemIntoView(item, pressedKey) { + if (this.isDisplayContents + || (! item.checkVisibility() && item.firstChild && item.firstChild.checkVisibility()) + ) { + // it's a pseudo item: display:contents, because the child is visible + this.isDisplayContents = true; + item.firstChild.scrollIntoView({block: "nearest"}); + let directionalNext = this.getDirectionalNext(item, pressedKey); + + if (directionalNext) { + directionalNext.firstChild.scrollIntoView({block: "nearest"}); + } + } + item.scrollIntoView({block: "nearest"}); let directionalNext = this.getDirectionalNext(item, pressedKey);