Skip to content

Commit

Permalink
OnKeyDown: find next selectable list item based on data-attr
Browse files Browse the repository at this point in the history
Dont explicitely check for .page-seperator to skip element, skip until an selectable one found or list ends
  • Loading branch information
sukhwinder33445 committed Jul 2, 2024
1 parent dd76acc commit 007bb78
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions asset/js/widget/ActionList.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ define(["../notjQuery"], function (notjQuery) {
return queryString.split('|');
}

/**
* Remove the `[ ]`brackets from the given identifier
* @param identifier
* @return {*}
*/
removeBrackets(identifier) {
return identifier.replaceAll(/[\[\]]/g, '');
}

/**
* Suspend auto refresh for the given item's container
*
Expand Down Expand Up @@ -332,11 +341,16 @@ define(["../notjQuery"], function (notjQuery) {
_this.handleLoadMoreNavigate(toActiveItem, lastActivatedItem, event.key);
return;
}
}

while (toActiveItem) {
if (toActiveItem.hasAttribute(this.removeBrackets(this.listItemIdentifier))) {
_this.clearSelection(activeItems);

_this.clearSelection(activeItems);
if (toActiveItem.classList.contains('page-separator')) {
toActiveItem = _this.getDirectionalNext(toActiveItem, event.key);
break;
}

toActiveItem = _this.getDirectionalNext(toActiveItem, event.key);
}
}

Expand Down Expand Up @@ -565,7 +579,7 @@ define(["../notjQuery"], function (notjQuery) {
// list has now new items, so select the lastActivatedItem and then move forward
let toActiveItem = lastActivatedItem.nextElementSibling;
while (toActiveItem) {
if (toActiveItem.hasAttribute(this.listItemIdentifier.replaceAll(/[\[\]]/g, ''))) {
if (toActiveItem.hasAttribute(this.removeBrackets(this.listItemIdentifier))) {
this.clearSelection([lastActivatedItem]);
this.setActive(toActiveItem);
this.setLastActivatedItemUrl(toActiveItem.dataset.icingaDetailFilter);
Expand Down

0 comments on commit 007bb78

Please sign in to comment.