Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B bootstrap
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 263
    • Issues 263
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 114
    • Merge requests 114
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Bootstrap
  • bootstrap
  • Issues
  • #37265
Closed
Open
Issue created Oct 06, 2022 by Thomas Portelange@lekoala3 of 3 checklist items completed3/3 checklist items

toast.js : Cannot read properties of null (reading 'classList')

Prerequisites

  • I have searched for duplicate or closed issues
  • I have validated any HTML to avoid common problems
  • I have read the contributing guidelines

Describe the issue

I'm having the following issue in production on one website

Cannot read properties of null (reading 'classList')

At the lines https://github.com/twbs/bootstrap/blob/bf6240dad9a466e9d3bc682abf416e9e5b4c66df/js/src/toast.js#L114-L116

My guess is that the element is already removed when that callback is called (i'm calling .dispose in the bs.hidden callback event I don't know if that's related or not. it should work without issues either way in my opinion).

Reduced test cases

My proposal is to simply add a null check before and return early if this._element is null

Demo https://codepen.io/lekoalabe/pen/oNdPNXJ

click create modal click create toast accept sweet alert modal try to click close icon on toast => it triggers the error

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

Windows

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

Chrome

What version of Bootstrap are you using?

v5.2.2

Assignee
Assign to
Time tracking