This modal can be closed with the escape key on your keyboard. Note: You need to press the tab key on the keyboard to first enter the modal window, and then press the Esc key.
The close button can be added by using the simple markup with CSS class. The main container for close button is the <button> tag with .
When the Button is clicked, the HTML DIV is referenced using jQuery and its modal function is called along with properties data-backdrop: "static" and data-keyboard: false which disables the closing of the Bootstrap Modal Popup when clicked outside.
The data-keyboard attribute specifies whether the modal can be closed with the escape key. Note: Press the Tab key on your keyboard to enter the modal window and then press the Esc key.
It looks like this is an issue with how the keyup event is being bound.
You can add the tabindex
attribute to you modal to get around this issue:
tabindex="-1"
So your full code should look like this:
<a href="#my-modal" data-keyboard="true" data-toggle="modal">Open Modal</a>
<div class='modal fade hide' id='my-modal' tabindex='-1'>
<div class='modal-body'>
<div>Test</div>
</div>
</div>
For more info you can view the discussion on this issue on github
(Updated link to new TWBS repository)
also if you're invoking via javascript , use this:
$('#myModal').modal({keyboard: true})
add tabindex="-1"
attribute to modal div
<div id="myModal" class="modal fade" role="dialog" tabindex="-1">
</div>
In angular I am using like this:
var modalInstance = $modal.open({
keyboard: false,
backdrop: 'static',
templateUrl: 'app/dashboard/view/currentlyIneligibleView.html',
controller: 'currentlyIneligibleCtrl',
resolve: {
data: function () { return param; }
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With