From 79de519ffa2b9474e3c57176d359d9428dc854e0 Mon Sep 17 00:00:00 2001 From: jacver <92895942+jacver@users.noreply.github.com> Date: Sat, 2 Sep 2023 19:09:34 -0400 Subject: [PATCH] Issues #13568/typeerror disabled menus (#13585) * conditional for entirely disabled lists * remove c.log --- src/app/components/menu/menu.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/app/components/menu/menu.ts b/src/app/components/menu/menu.ts index 7c787dc1fc4..2418ba21800 100755 --- a/src/app/components/menu/menu.ts +++ b/src/app/components/menu/menu.ts @@ -607,8 +607,10 @@ export class Menu implements OnDestroy { changeFocusedOptionIndex(index) { const links = DomHandler.find(this.containerViewChild.nativeElement, 'li[data-pc-section="menuitem"][data-p-disabled="false"]'); - let order = index >= links.length ? links.length - 1 : index < 0 ? 0 : index; - order > -1 && this.focusedOptionIndex.set(links[order].getAttribute('id')); + if(links.length > 0) { + let order = index >= links.length ? links.length - 1 : index < 0 ? 0 : index; + order > -1 && this.focusedOptionIndex.set(links[order].getAttribute('id')); + } } itemClick(event: any) {