The Wayback Machine - https://web.archive.org/web/20250826233837/https://github.com/twbs/bootstrap/issues/37500
Skip to content

Can't close modal if there is a javascript Modal object created after shown. #37500

@mfazekas

Description

@mfazekas

Prerequisites

Describe the issue

Sometime the data-bs-dismiss="modal" doesn't work and doesn't closes the modal

Reduced test cases

  1. Open https://getbootstrap.com/docs/5.2/components/modal/ in browser
  2. In console execute this:
    modal = new bootstrap.Modal(document.querySelectorAll('#exampleModal')[0]) 
    modal.show()
    modal2 = new bootstrap.Modal(document.querySelectorAll('#exampleModal')[0])
  3. Try to close the modal with the x button.

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

macOS

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

Safari

What version of Bootstrap are you using?

5.2.2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions