As per Bootstrap docs:

Clicking on the modal “backdrop” will automatically close the modal.

When backdrop is set to static, the modal will not close when clicking outside it.

Via JS:

$('#myModal').modal({
    backdrop: 'static',
    keyboard: false
})

$('#myModal').modal({backdrop: 'static', keyboard: false}, 'show');

Via HTML:

<a data-controls-modal="your_div_id" data-backdrop="static" data-keyboard="false" href="#">
Answer from Ehsan Zargar Ershadi on Stack Overflow
🌐
Bootstrap
getbootstrap.com › docs › 4.4 › components › modal
Modal · Bootstrap
It also adds .modal-open to the <body> to override default 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.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....
🌐
MDBootstrap
mdbootstrap.com › standard › modal backdrop
Bootstrap Modal Backdrop - free examples & tutorial
<!-- Button trigger modal --> <button type="button" data-mdb-button-init data-mdb-ripple-init class="btn btn-primary" data-mdb-modal-init data-mdb-target="#exampleModal2"> Launch demo modal </button> <!-- Modal --> <div class="modal top fade" id="exampleModal2" tabindex="-1" aria-labelledby="exampleModal2Label" aria-hidden="true" data-mdb-backdrop="static" data-mdb-keyboard="true"> <div class="modal-dialog "> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModal2Label">Modal title</h5> <button type="button" data-mdb-button-init data-mdb-ripple-init cla
🌐
GeeksforGeeks
geeksforgeeks.org › bootstrap › 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.
🌐
Bootstrap Shuffle
bootstrapshuffle.com › classes › modals › modal-static
modal-static - Bootstrap CSS class
← all Bootstrap classes list · <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#staticBackdrop"> Launch static backdrop modal </button> <div class="modal fade" id="staticBackdrop" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="staticBackdropLabel">Modal title</h5> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> </div> <div class="modal-body"> Lorem ipsum dolor sit amet consectetur adipisicing elit.
🌐
CodePen
codepen.io › cristinaconacel › pen › ZmxgYm
Bootstrap 4 Basic Modal with Static Backdrop
<div class="container"> <button type="button" class="btn btn-danger" data-toggle="modal" data-target="#glassAnimals" data-backdrop="static"> Glass Animals Info </button> </div> <div class="modal fade" id="glassAnimals" tabindex="-1" role="dialog" ...
🌐
MDBootstrap
mdbootstrap.com › standard › material design for bootstrap 5 & vanilla javascript
Modal backdrop: static not allowing clicks without closing t - Material Design for Bootstrap
The tittle says it all. Regarding documentation https://mdbootstrap.com/angular/advanced/modals/#options Type: boolean | "static" Includes a modal-backdrop element. Alternatively, specify static for a backdrop which doesn't close the modal on click.
Find elsewhere
🌐
React Bootstrap
react-bootstrap.netlify.app › modals
Modals | React Bootstrap
When backdrop is set to static, the modal will not close when clicking outside it. Click the button below to try it. Result · Loading... Live Editor · import { useState } from 'react'; import Button from 'react-bootstrap/Button'; import Modal from 'react-bootstrap/Modal'; function Example() ...
🌐
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....
🌐
GitHub
github.com › valor-software › ngx-bootstrap › issues › 568
bug(modal): data-backdrop="static", data-keyboard="false" not work · Issue #568 · valor-software/ngx-bootstrap
June 2, 2016 - In Bootstrap 4, we can disable click outside of bootstrap model area to close modal by adding data-backdrop="static". And data-keyboard="false" to prevent close on ESC button. Like this:
Author   hongbo-miao
🌐
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 › 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
<!-- Button trigger modal --> <button type="button" class="btn btn-primary" data-mdb-toggle="modal" data-mdb-target="#exampleModal2"> Launch demo modal </button> <!-- Modal --> <div class="modal top fade" id="exampleModal2" tabindex="-1" aria-labelledby="exampleModal2Label" aria-hidden="true" data-mdb-backdrop="static" data-mdb-keyboard="true"> <div class="modal-dialog "> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModal2Label">Modal title</h5> <button type="button" class="btn-close" data-mdb-dismiss="modal" aria-label="Close"></button> </div> <div class="modal-body">...</div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-mdb-dismiss="modal"> Close </button> <button type="button" class="btn btn-primary">Save changes</button> </div> </div> </div> </div>
Author   mdbootstrap
🌐
GitHub
github.com › twbs › bootstrap › issues › 30647
Bootstrap v4.4.1 Modal with data-backdrop="static" data-keyboard="false" blinks on outside click. · Issue #30647 · twbs/bootstrap
April 26, 2020 - From version 4.4.0, modal with data-backdrop="static" data-keyboard="false" blinks on outside click. If the page has a scroll or the modal is vertically centered then the scroll...
Author   TanvirArjel
🌐
GitHub
github.com › valor-software › ngx-bootstrap › issues › 5409
How to configure a modal to always have backdrop = 'static' · Issue #5409 · valor-software/ngx-bootstrap
October 1, 2019 - this.modalRef = this.modalService.show(ModalVideoComponent, { initialState: { video: video }, class: 'modal-md', backdrop: 'static' });
Author   williamxsp
🌐
JSFiddle
jsfiddle.net › Richard_Liu › nn093m84
Bootstrap Modal Backdrop Static. - JSFiddle - Code Playground
JSFiddle - Test your JavaScript, CSS, HTML or CoffeeScript online with JSFiddle.
🌐
GitHub
github.com › twbs › bootstrap › issues › 30322
Click on Static Modal Backdrop Scaling up the Modal Content and Adding Scrollbar to Backdrop · Issue #30322 · twbs/bootstrap
March 1, 2020 - ` <div class="container p-5"> <!-- Button trigger modal --> <button type="button" class="btn btn-primary" data-toggle="modal" data- target="#staticBackdrop"> Launch static backdrop modal </button> <!-- Modal --> <div class="modal fade" id="staticBackdrop" data-backdrop="static" tabindex="-1" role="dialog" aria-labelledby="staticBackdropLabel" aria-hidden="true"> <div class="modal-dialog modal-lg modal-dialog-centered" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="staticBackdropLabel">Modal title</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">&times;</span> </button> </div> <div class="modal-body"> ...
Author   Behseini