Offcanvas is not dismissed, starts to stack
Author: lehervCreated Jan 30, 2024Updated May 6, 2026
Labelscomponent: modalneeds: investigationtype: bugcomponent: offcanvas
Bug description:
When hooking this function to a button that can be clicked multiple times the offcanvas is only closed and opened correctly once. After that the offcanvas elements start stacking over each other:
closeThenOpenDrawer() { this.offcanvasService.dismiss(); this.offcanvasService.open(OffcanvasDrawerComponent, { backdrop: false, position: 'bottom' }) }
Link to minimally-working StackBlitz that reproduces the issue:
https://stackblitz.com/edit/angular-bvjb8m-wqdm2w?file=src%2Fapp%2Foffcanvas-component.ts
Versions of Angular, ng-bootstrap and Bootstrap:
I used your Stackblitz example Angular: 17.09
ng-bootstrap: 16.0.0
Bootstrap: 5.3.2
Source: ng-bootstrap/ng-bootstrap