diff --git a/src/app/components/tieredmenu/tieredmenu.ts b/src/app/components/tieredmenu/tieredmenu.ts index cc7348ebf46..bbce05b8689 100755 --- a/src/app/components/tieredmenu/tieredmenu.ts +++ b/src/app/components/tieredmenu/tieredmenu.ts @@ -231,10 +231,10 @@ export class TieredMenuSub { @ViewChild('sublist', { static: true }) sublistViewChild: ElementRef; - constructor(public el: ElementRef, public renderer: Renderer2, private cd: ChangeDetectorRef, @Inject(forwardRef(() => TieredMenu)) public tieredMenu: TieredMenu) {} + constructor(public el: ElementRef, public renderer: Renderer2, @Inject(forwardRef(() => TieredMenu)) public tieredMenu: TieredMenu) {} positionSubmenu() { - let sublist = this.sublistViewChild && this.sublistViewChild.nativeElement; + const sublist = this.sublistViewChild && this.sublistViewChild.nativeElement; if (sublist) { const parentItem = sublist.parentElement.parentElement; @@ -506,8 +506,6 @@ export class TieredMenu implements OnInit, AfterContentInit, OnDestroy { relativeAlign: boolean | undefined; - private window: Window; - dirty: boolean = false; focused: boolean = false; @@ -552,7 +550,6 @@ export class TieredMenu implements OnInit, AfterContentInit, OnDestroy { public config: PrimeNGConfig, public overlayService: OverlayService ) { - this.window = this.document.defaultView as Window; effect(() => { const path = this.activeItemPath(); @@ -860,7 +857,6 @@ export class TieredMenu implements OnInit, AfterContentInit, OnDestroy { anchorElement ? anchorElement.click() : element && element.click(); - const processedItem = this.visibleItems[this.focusedItemInfo().index]; if (!this.popup) { const processedItem = this.visibleItems[this.focusedItemInfo().index]; const grouped = this.isProccessedItemGroup(processedItem); @@ -891,8 +887,6 @@ export class TieredMenu implements OnInit, AfterContentInit, OnDestroy { onMenuFocus(event: any) { this.focused = true; - const focusedItemInfo = this.focusedItemInfo().index !== -1 ? this.focusedItemInfo() : { index: this.findFirstFocusedItemIndex(), level: 0, parentKey: '', item: this.visibleItems[this.findFirstFocusedItemIndex()]?.item }; - this.focusedItemInfo.set(focusedItemInfo); } onMenuBlur(event: any) { @@ -996,7 +990,7 @@ export class TieredMenu implements OnInit, AfterContentInit, OnDestroy { this.relativeAlign = event?.relativeAlign || null; } - this.focusedItemInfo.set({ index: this.findFirstFocusedItemIndex(), level: 0, parentKey: '' }); + this.focusedItemInfo.set({ index: -1, level: 0, parentKey: '' }); isFocus && DomHandler.focus(this.rootmenu.sublistViewChild.nativeElement);