Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/primefaces/primeng
Browse files Browse the repository at this point in the history
  • Loading branch information
cetincakiroglu committed Mar 20, 2024
2 parents 283c71b + 11766c3 commit c89e282
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/app/components/tieredmenu/tieredmenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,11 @@ export class TieredMenuSub {
}

getAriaPosInset(index: number) {
return index - this.items.slice(0, index).filter((processedItem) => this.isItemVisible(processedItem) && this.getItemProp(processedItem, 'separator')).length + 1;
return index - this.items.slice(0, index).filter((processedItem) => {
const isItemVisible = this.isItemVisible(processedItem);
const isVisibleSeparator = isItemVisible && this.getItemProp(processedItem, 'separator');
return !isItemVisible || isVisibleSeparator;
}).length + 1;
}

isItemVisible(processedItem: any): boolean {
Expand Down Expand Up @@ -625,13 +629,17 @@ export class TieredMenu implements OnInit, AfterContentInit, OnDestroy {
}

isValidItem(processedItem: any): boolean {
return !!processedItem && !this.isItemDisabled(processedItem.item) && !this.isItemSeparator(processedItem.item);
return !!processedItem && !this.isItemDisabled(processedItem.item) && !this.isItemSeparator(processedItem.item) && this.isItemVisible(processedItem.item);
}

isItemDisabled(item: any): boolean {
return this.getItemProp(item, 'disabled');
}

isItemVisible(item: any): boolean {
return this.getItemProp(item, 'visible') !== false;
}

isItemSeparator(item: any): boolean {
return this.getItemProp(item, 'separator');
}
Expand Down

0 comments on commit c89e282

Please sign in to comment.