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 esc key. Then it should show the user that anything is important in modal (user needs to check modal) by showing any animation like scale to get the user attention there. Like the chrome's clear browser data modal:

What if bootstrap fired a hidePrevented.bs.modal event?
You could then control what happens... perhaps bootstrap could do the animation unless you call preventDefault() on the event
Yes! It may be a better solution to handle this situation more easily. Then user will have more options to animate the modal. Like using animate.css.
@bkdotcom this kind of event should be great to do whatever the developer wants to give any feedback.
Agree. In applications with both static and non-static modals, user may be confused with these two different behaviors without feedback (on hide prevented).
It looks like we could fire the event from here:
https://github.com/twbs/bootstrap/blob/32ab52ba2e9dc2549304fcef14dede7806384f34/js/src/modal.js#L355-L359
@Johann-S I just wanted to know if there was a slight chance of getting this new feature for v5? Just asking, I know you guys are busy with this next major release.
Yep why not, it seems useful to me, btw we are open for PRs 馃槃
Can I try to resolve this issue?
@webframing I'm confused about the status of this request. It's still showing "Assignees: No one assigned" on v4.4.0 To do list yet it seems that the request has moved along since and appears resolved now by @anjoshigor #29516
This is in master and will be in v4.4.0 too.
Most helpful comment
What if bootstrap fired a
hidePrevented.bs.modalevent?You could then control what happens... perhaps bootstrap could do the animation unless you call
preventDefault()on the event