If the modal container has a fixed or relative position or is within an element with fixed or relative position this behavior will occur.

Make sure the modal container and all of its parent elements are positioned the default way to fix the problem.

Here are a couple ways to do this:

  1. Easiest way is to just move the modal div so it is outside any elements with special positioning. One good place might be just before the closing body tag </body>.
  2. Alternatively, you can remove position: CSS properties from the modal and its ancestors until the problem goes away. This might change how the page looks and functions, however.
Answer from Muhd on Stack Overflow
🌐
Bootstrap
getbootstrap.com › docs › 5.0 › components › modal
Modal · Bootstrap v5.0
The modal plugin toggles your hidden ... scrolling behavior and generates a .modal-backdrop to provide a click area for dismissing shown modals when clicking outside the modal....
🌐
Bootstrap
getbootstrap.com › docs › 5.2 › components › modal
Modal · Bootstrap v5.2
The modal plugin toggles your hidden ... scrolling behavior and generates a .modal-backdrop to provide a click area for dismissing shown modals when clicking outside the modal....
🌐
MDBootstrap
mdbootstrap.com › standard › modal backdrop
Bootstrap Modal Backdrop - free examples & tutorial
Backdrop options for a responsive popup with Bootstrap 5. Prevent close on click outside with static backdrop, remove backdrop, enable interactivity & more. Default modal backdrop is a delicate shadow overlaying the rest of the page design.
🌐
GitHub
github.com › mdbootstrap › bootstrap-modal-backdrop
GitHub - mdbootstrap/bootstrap-modal-backdrop: Backdrop options for a responsive popup with Bootstrap 5. Prevent close on click outside with static backdrop, remove backdrop, enable interactivity & more. · GitHub
Backdrop options for a responsive popup with Bootstrap 5. Prevent close on click outside with static backdrop, remove backdrop, enable interactivity & more. - mdbootstrap/bootstrap-modal-backdrop
Author   mdbootstrap
🌐
GeeksforGeeks
geeksforgeeks.org › bootstrap-5-modal-static-backdrop
Bootstrap 5 Modal Static backdrop | GeeksforGeeks
November 30, 2022 - Bootstrap 5 Modal Static backdrop facilitates the modal that will not be going to be closed while clicking outside of the modal, by setting the backdrop to static. Modal Static backdrop Classes: There are no specific classes used in Modal Static ...
🌐
Bootstrap
getbootstrap.com › docs › 5.3 › components › modal
Modal · Bootstrap v5.3
The modal plugin toggles your hidden ... scrolling behavior and generates a .modal-backdrop to provide a click area for dismissing shown modals when clicking outside the modal....
🌐
MDBootstrap
mdbootstrap.com › standard › modal backdrop
React Bootstrap 5 Modal Backdrop - free examples & tutorial
React Backdrop options for a responsive popup with Bootstrap 5. Prevent close on click outside with static backdrop, remove backdrop, enable interactivity & more. Default modal backdrop is a delicate shadow overlaying the rest of the page design.
Find elsewhere
🌐
Bbbootstrap
bbbootstrap.com › home › snippets › bootstrap 5 static backdrop modal
Bootstrap 5 Static backdrop modal Example
This snippet is free and open source hence you can use it in your project.Bootstrap 5 Static backdrop modal snippet example is best for all kind of projects.A great starter for your new awesome project with 1000+ Font Awesome Icons, 4000+ Material Design Icons and Material Design Colors at BBBootstrap.com.
🌐
npm
npmjs.com › package › bootstrap-modal-backdrop
bootstrap-modal-backdrop - npm
June 15, 2022 - Backdrop options for a responsive popup with Bootstrap 5. Prevent close on click outside with static backdrop, remove backdrop, enable interactivity & more.. Latest version: 1.0.1, last published: 4 years ago. Start using bootstrap-modal-backdrop in your project by running `npm i ...
      » npm install bootstrap-modal-backdrop
    
🌐
GeeksforGeeks
geeksforgeeks.org › bootstrap-5-modal-options
Bootstrap 5 Modal Options | GeeksforGeeks
August 1, 2024 - Bootstrap 5 Modal option can be used in two ways using data attributes and using JavaScript. Options are added to append different utilities and properties to the modal like having a backdrop on the background while the modal is open, etc.
🌐
Ordinarycoders
ordinarycoders.com › blog › article › bootstrap5-modal-cheatsheet
Bootstrap 5 Pop-up Modals: Cheat Sheet
This prevents the user from dismissing the modal by clicking off it or clicking escape. Add data-bs-backdrop="static" and data-bs-keyboard="False" to the division element with the modal class attribute value.
🌐
W3Schools
w3schools.com › bootstrap5 › bootstrap_modal.php
Bootstrap 5 Modal
Text Colors Background Colors BS5 Tables BS5 Images BS5 Jumbotron BS5 Alerts BS5 Buttons BS5 Button Groups BS5 Badges BS5 Progress Bars BS5 Spinners BS5 Pagination BS5 List Groups BS5 Cards BS5 Dropdowns BS5 Collapse BS5 Navs BS5 Navbar BS5 Carousel BS5 Modal BS5 Tooltip BS5 Popover BS5 Toast BS5 Scrollspy BS5 Offcanvas BS5 Utilities BS5 Dark Mode BS5 Flex
🌐
MDBootstrap
mdbootstrap.com › standard › modal
Bootstrap Modal - free examples & tutorial
The modal plugin toggles your hidden ... scrolling behavior and generates a .modal-backdrop to provide a click area for dismissing shown modals when clicking outside the modal....
🌐
Bootstrap
getbootstrap.com › docs › 4.4 › components › modal
Modal · Bootstrap
Call a modal with id myModal with a single line of JavaScript: ... Options can be passed via data attributes or JavaScript. For data attributes, append the option name to data-, as in data-backdrop="".
🌐
Tutorial Republic
tutorialrepublic.com › codelab.php
Live Demo: Bootstrap Modal with Static Backdrop
View the live example as well as try and test it using the online HTML editor.
🌐
GitHub
github.com › cypress-io › cypress › issues › 25202
Bootstrap modal and backdrop issue · Issue #25202 · cypress-io/cypress
December 17, 2022 - Having this bootstrap modal displayed, when clicking "Close", modal is hidden, but backdrop is always here (Working on Chrome or Safari). ... Backdrop should be auto removed as in my Chrome browser. ... <div class="modal fade" id="modal-id" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <h1 class="modal-title fs-5">Header</h1> </div> <div class="modal-body">Body</div> <div class="modal-footer text-center"> <button type="button" class="btn btn-primary" data-bs-dismiss="modal"> Close </button> </div> </div> </div> </div>
Author   lugosium
🌐
W3Schools
w3schools.com › bootstrap › tryit.asp
Modal Options
The W3Schools online code editor allows you to edit code and view the result in your browser