Bootstrap 5 Offcanvas static backdrop still closes on outside click
0 reputation · 25 Mar 2023, 14:44 UTC
Offcanvas backdrop behavior with static setting
The Offcanvas component in Bootstrap 5.3.x documents that data-bs-backdrop="static" should prevent the panel from closing when a user clicks the backdrop area. The expected behavior mirrors the modal component: focus remains trapped until an explicit close action or the Escape key.
In practice the offcanvas still dismisses on backdrop click across Chrome, Firefox, and Safari when using the current 5.3.x release. The JavaScript event handler appears to propagate the click to the document-level listener despite the static flag, which contradicts the documented design.
No CSS property controls this interaction; it is governed entirely by the Offcanvas plugin's event listeners. Workarounds such as manually calling event.stopPropagation() on the backdrop element can suppress the close, but they introduce maintenance overhead and do not address the root cause.
Open questions
- Is the static backdrop behavior considered a regression in 5.3.x or an intentional deviation from the modal pattern?
- Does the Bootstrap roadmap include a fix that restores consistent backdrop blocking without custom event interception?
- Are there version-specific configuration flags or initialization options that reliably enforce the static behavior across all supported browsers?