Skip to content

Offcanvas hide() then dispose() runs into "this._element is null" #41473

Open
@steffen-harbich-cognitum

Description

Prerequisites

Describe the issue

I use the Offcanvas to show navigation items. Clicking on a navigation item calls hide() and starts a navigation (Angular client-side routing). Now, when the navigation leads to a page that does not have the offcanvas in it, the dispose() is called, too. This happens before the animation of hide() is finished and results in the following error:

ERROR TypeError: this._element is null
completeCallback offcanvas.js:124
execute index.js:203
handler index.js:221
Angular 10
triggerTransitionEnd index.js:76
executeAfterTransition index.js:226
Angular 21
executeAfterTransition index.js:224
_queueCallback base-component.js:48
hide offcanvas.js:132
close compact-navigation.component.ts:88
navigate compact-navigation.component.ts:96

Code line:

const completeCallback = () => {

Expectation: Offcanvas should not continue hiding when disposed already.

Reduced test cases

Example here

  • click button to open offcanvas
  • click button in offcanvas
  • observe console error

What operating system(s) are you seeing the problem on?

Windows

What browser(s) are you seeing the problem on?

Firefox

What version of Bootstrap are you using?

5.3.5

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions