Skip to content

Commit

Permalink
ActionList: Take items with css propery display:contents into account
Browse files Browse the repository at this point in the history
For example, the elements of icingadb/hostgroup are `display:contents`, which leads to scrollIntoView() having no effect.
  • Loading branch information
sukhwinder33445 committed Jul 30, 2024
1 parent 19f322b commit 41d14cf
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion asset/js/widget/ActionList.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ define(["../notjQuery"], function ($) {
this.lastActivatedItemUrl = null;
this.lastTimeoutId = null;
this.processing = false;
this.isDisplayContents = false;

let firstItem = this.getDirectionalNext(null, false);
if (firstItem
&& (! firstItem.checkVisibility() && firstItem.firstChild && firstItem.firstChild.checkVisibility())
) {
this.isDisplayContents = true;
}
}

bind() {
Expand Down Expand Up @@ -406,9 +414,13 @@ define(["../notjQuery"], function ($) {
* @param isArrowUp Whether the arrow up key is pressed, if not, arrow down key is assumed
*/
scrollItemIntoView(item, isArrowUp) {
item.scrollIntoView({block: "nearest"});
let directionalNext = this.getDirectionalNext(item, isArrowUp);
if (this.isDisplayContents) {
item = item.firstChild;
directionalNext = directionalNext ? directionalNext.firstChild : null;
}

item.scrollIntoView({block: "nearest"});
if (directionalNext) {
directionalNext.scrollIntoView({block: "nearest"});
}
Expand Down

0 comments on commit 41d14cf

Please sign in to comment.