From 1f23736c2b6dc221b2d1a552d3549bd82c315124 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tu=C4=9F=C3=A7e=20K=C3=BC=C3=A7=C3=BCko=C4=9Flu?= Date: Tue, 1 Jun 2021 12:26:15 +0300 Subject: [PATCH] Fixed #1310 - Programmatic PanelMenu header link needs click twice to toggle itself --- src/components/panelmenu/PanelMenu.vue | 6 +++++- src/components/panelmenu/PanelMenuSub.vue | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/panelmenu/PanelMenu.vue b/src/components/panelmenu/PanelMenu.vue index e1995d7e9..c460d1518 100755 --- a/src/components/panelmenu/PanelMenu.vue +++ b/src/components/panelmenu/PanelMenu.vue @@ -57,6 +57,10 @@ export default { }, methods: { onItemClick(event, item, navigate) { + if (this.isActive(item) && this.activeItem === null) { + this.activeItem = item; + } + if (item.disabled) { event.preventDefault(); return; @@ -97,7 +101,7 @@ export default { return ['p-panelmenu-panel', item.class]; }, getPanelToggleIcon(item) { - const active = item === this.activeItem; + const active = this.isActive(item) && this.activeItem === null ? true : item === this.activeItem; return ['p-panelmenu-icon pi', {'pi-chevron-right': !active,' pi-chevron-down': active}]; }, getPanelIcon(item) { diff --git a/src/components/panelmenu/PanelMenuSub.vue b/src/components/panelmenu/PanelMenuSub.vue index 069ea6fab..b2c74c14e 100755 --- a/src/components/panelmenu/PanelMenuSub.vue +++ b/src/components/panelmenu/PanelMenuSub.vue @@ -54,6 +54,10 @@ export default { }, methods: { onItemClick(event, item, navigate) { + if (this.isActive(item) && this.activeItem === null) { + this.activeItem = item; + } + if (item.disabled) { event.preventDefault(); return;