Hi,
We noticed that when you click on the expanded sidebar in the main app, it doesn't immediately close. Instead, you have to move the cursor away from the expanded sidebar for the closing to happen.
We were wondering if there is a way to change it so that it closes right away?
The project is based off of the microservice template in case that's useful.
Thank you, Daniel
5 Answer(s)
-
0
To make the sidebar in your ABP Angular application close immediately when you click to minimize it (instead of waiting for the mouse to leave), you need to adjust the sidebar's toggle logic. By default, the sidebar in ABP Angular (especially in the microservice template) uses a hover-based expansion and collapse mechanism, which is why it waits for the mouse to leave before collapsing.
To change this behavior:
Locate the sidebar component, typically found in
src/app/layout/sidebar
or similar (often namedsidebar.component.ts
andsidebar.component.html
).Find the method or event handler responsible for toggling the sidebar. This is usually a function like
toggleSidebar()
or similar, triggered by a button or icon click.Modify the logic so that clicking the minimize/collapse button immediately sets the sidebar to its collapsed state, regardless of mouse position. For example:
// sidebar.component.ts isSidebarCollapsed = false; onToggleSidebar() { this.isSidebarCollapsed = !this.isSidebarCollapsed; // Optionally, trigger change detection or emit an event if needed }
And in your template:
<!-- sidebar.component.html --> <button (click)="onToggleSidebar()">Toggle Sidebar</button> <div [class.collapsed]="isSidebarCollapsed"> <!-- Sidebar content --> </div>
Remove or adjust any mouseleave/mouseenter logic that delays the collapse, so the sidebar responds instantly to the click.
If your sidebar uses a service or state management for its open/close state, ensure the state is updated immediately on click.
This change will make the sidebar collapse as soon as the user clicks the minimize button, providing the immediate feedback you want.
Sources:
This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.
-
0
I would like to also hear from the ABP Support Team, thank you.
-
0
hi
We noticed that when you click on the expanded sidebar in the main app, it doesn't immediately close. Instead, you have to move the cursor away from the expanded sidebar for the closing to happen.
Can you share a GIF?
Thanks.
-
0
Hi @maliming,
Here is a GIF of the current behaviour.
I am wondering if we can change it so that when the user presses on the sidebar icon, it immediately closes the sidebar (note how the main content on the right immediately adjusts its width after clicking on the sidebar collapse icon).
Thanks, Daniel
-
0
hi
I will check this. Thanks.