From 5d8e9b2b4bce3888524315f67e2d97154183f55d 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 fd29d06a..f09af805 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.isDisplayContants = null; } bind() { @@ -398,6 +400,19 @@ define(["../notjQuery"], function ($) { * @param pressedKey Pressed key (`ArrowUp` or `ArrowDown`) */ scrollItemIntoView(item, pressedKey) { + if (this.isDisplayContants + || (! item.checkVisibility() && item.firstChild && item.firstChild.checkVisibility()) + ) { + // it's a pseudo item: display:contents, because the child is visible + this.isDisplayContants = 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);