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
🌐
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
Discussions

data-backdrop is not working on livewire.
Hello! I try to prevent the modal to close when click outside the modal. It's working on my one project but in my new setup it doesn't working.. Does the livewire component has a conflict o... More on github.com
🌐 github.com
1
1
Bootstrap v4.4.1 Modal with data-backdrop="static" data-keyboard="false" blinks on outside click.
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... More on github.com
🌐 github.com
9
April 25, 2020
data-bs-backdrop and data-bs-keyboard not functioning on v5.0.1
Trying to use the data-bs-backdrop="static" and data-bs-backdrop="false" to manipulate how the modal backdrop is working. It worked on the 5.0.0-beta2 version. However, it does not seem to be working on the 5.0.1 version. The data-bs-keyboard also seems to not be working. More on github.com
🌐 github.com
8
May 21, 2021
bootstrap - modal pop window backdrop static not working - Salesforce Stack Exchange
I have bootstrap modal pop-up window. I want the background to be non-clickable. I have close button to close the modal pop-up, so the users should use only that. Clicking outside the modal pop-up More on salesforce.stackexchange.com
🌐 salesforce.stackexchange.com
🌐
Bootstrap
getbootstrap.com › docs › 5.0 › components › modal
Modal · Bootstrap v5.0
<!-- Button trigger modal --> <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#staticBackdrop"> Launch static backdrop modal </button> <!-- Modal --> <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"> ...
🌐
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 25, 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
🌐
Keen Themes
devs.keenthemes.com › question › backdrop-modal-static-and-keyboard-false-vue
Backdrop Modal Static And Keyboard False - Vue - Keenthemes
I want the modal has the following options: backdrop: 'static', keyboard: false How to manage this? I want a modal which is not able to close at at by clicking outside the modal, nor by keyboard. N. 3 years ago ... Hi, You can set those properties with the following attributes. ... data-bs-backdrop="static" data-bs-keyboard="false" Refer to bootstrap 5 official documentation: Regards, Lauris Stepanovs, Keenthemes Support Team
🌐
GitHub
github.com › twbs › bootstrap › issues › 34069
data-bs-backdrop and data-bs-keyboard not functioning on v5.0.1 · Issue #34069 · twbs/bootstrap
May 21, 2021 - Trying to use the data-bs-backdrop="static" and data-bs-backdrop="false" to manipulate how the modal backdrop is working. It worked on the 5.0.0-beta2 version. However, it does not seem to be working on the 5.0.1 version. The data-bs-keyboard also seems to not be working.
Published   May 21, 2021
Author   javierian1313
Find elsewhere
🌐
Bootstrap
getbootstrap.com › docs › 4.4 › components › modal
Modal · Bootstrap
For data attributes, append the option name to data-, as in data-backdrop="". All API methods are asynchronous and start a transition. They return to the caller as soon as the transition is started but before it ends. In addition, a method call on a transitioning component will be ignored. See our JavaScript documentation for more information. Activates your content as a modal. Accepts an optional options object. $('#myModal').modal({ keyboard: false }) Manually toggles a modal.
🌐
Bootstrap
getbootstrap.com › docs › 5.2 › components › modal
Modal · Bootstrap v5.2
<!-- Button trigger modal --> <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#staticBackdrop"> Launch static backdrop modal </button> <!-- Modal --> <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"> <h1 class="modal-title fs-5" id="staticBackdropLabel">Modal title</h1> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> </div> <div class="modal-body"> ...
🌐
W3Schools
w3schools.com › bootstrap › › tryit.asp
W3Schools online HTML editor
The W3Schools online code editor allows you to edit code and view the result in your browser
🌐
Bootstrap
getbootstrap.com › docs › 4.6 › components › modal
Modal · Bootstrap v4.6
<!-- 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" data-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="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">&times;</span> </button> </div> <div class="modal-body"> ...
🌐
Lightrun
lightrun.com › answers › valor-software-ngx-bootstrap-bugmodal-data-backdropstatic-data-keyboardfalse-not-work
bug(modal): data-backdrop="static", data-keyboard="false" not work
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 ...
🌐
Bootstrap Shuffle
bootstrapshuffle.com › classes › modals › modal-static
modal-static - Bootstrap CSS class
<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.
🌐
Bootstrap
getbootstrap.com › docs › 5.3 › components › modal
Modal · Bootstrap v5.3
<!-- Button trigger modal --> <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#staticBackdrop"> Launch static backdrop modal </button> <!-- Modal --> <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"> <h1 class="modal-title fs-5" id="staticBackdropLabel">Modal title</h1> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> </div> <div class="modal-body"> ...
🌐
GitHub
github.com › twbs › bootstrap › issues › 26704
Feature Request: Add animation to modal when its backdrop is static. · Issue #26704 · twbs/bootstrap
May 6, 2018 - When the modal has the property: {backdrop: 'static', keyboard: false} Or when it has the attributes: data-backdrop="static" data-keyboard="false" Obviously, it would not be close if the user tries to click outside of it and also using e...
Author   webframing
🌐
MDBootstrap
mdbootstrap.com › standard › material design for bootstrap 5 & vanilla javascript
Modal backdrop: static not allowing clicks without closing t - Material Design for Bootstrap
@Nate To achieve this kind of functionality, you can use the cookie modal and set the ignoreBackdropClick to false. https://mdbootstrap.com/docs/angular/modals/additional/#modalCookiesSec ...
🌐
West-wind
support.west-wind.com › Thread6ZY07VWR0.wwt
static backdrop modal - West Wind Technologies Support
September 18, 2024 - toHTMLgen.cScriptJSadd (TEXTMERGE ([jQuery('#modal-<<THISFORM.wcID>>').removeAttr("data-backdrop").attr("data-bs-backdrop", "static").attr(" data-bs-keyboard", "false");])) && Static