Get 2024 Templates Mega Bundle!14 Bootstrap, Vue & React Templates + 3 Vector Sets
Get for 99$

Sidebar Navigation Issue of sub menu accordions active in Angular


Hello,

I have found a very weird issue in the navigation of angular versions of metronic 8.
Try to follow the following procedure.

1. Please visit this link. Click here
2. Click on Pages > Profile > Projects in left side bar navigation and wait for page to load.
3. Now click on Dashboard or Layout Builder in left side bar navigation and wait for page to load.
4. You will see Pages > Profile > Projects is still active in the side bar navigation but which should not be like that. I am sharing the screenshot for the reference.

Please let me know if you guys need a video for the same..

Link for the image - Click Here


Thanks.


Text formatting options
Submit

Replies (5)


Hi,

Any update on this?

Regards.



Hi Durvesh,

Thank you for your feedback. We are aware of the issue now. We will check it further to fix the issue.

Thanks



Hello,

I found out that replacing routerLinkActive="menu-active-bg" with "here show" in the sub-accordion item fixes the sub menu not collapsing after changing routes.
The parent item still shows up as active until you click it again, though. Still trying to find a workaround.

Hope this helps.



Hi,

Thank you so much for looking into this. I have added your input at my end. But I will still look for the final solution from your end.

Appreciated.
Thanks & Regards
Durvesh Parmar



Hi Durvesh,

To address the issue with the sidebar navigation sub-menu accordions, you can make the following changes into file /src/app/_metronic/kt/components/MenuComponent.ts:

1. Add `this._hideAccordions(element)` inside the `_link` function:

private _link = (element: HTMLElement, e: Event) => {
// ...
this._hideAccordions(element);
// ...
}

This ensures that the accordions are hidden when a new item is linked.

2. Change `.show[data-kt-menu-trigger]` to `.hover[data-kt-menu-trigger]`:

private _hideAccordions = (item: HTMLElement) => {
const itemsToHide = this.element.querySelectorAll(".hover[data-kt-menu-trigger]");
// ...
}

By using `.hover[data-kt-menu-trigger]` instead of `.show[data-kt-menu-trigger]`, the accordions will be triggered on hover instead of being shown by default.

Make sure to apply these changes to the relevant sections of your code to resolve the issue with the sub-menu accordions in the sidebar navigation.

We will include the fix in the update soon.

Thanks


Text formatting options
Submit
Text formatting options
Submit