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 29, 2024
1 parent bd407d9 commit a8d4219
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions asset/js/widget/ActionList.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ define(["../notjQuery"], function ($) {
this.lastActivatedItemUrl = null;
this.lastTimeoutId = null;
this.processing = false;

this.isDisplayContants = null;
}

bind() {
Expand Down Expand Up @@ -402,6 +404,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);

Expand Down

0 comments on commit a8d4219

Please sign in to comment.