mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-21 04:41:36 +02:00
Don't hide modal when `config.keyboard` is false
This commit is contained in:
@@ -230,7 +230,6 @@ class Modal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_triggerBackdropTransition() {
|
_triggerBackdropTransition() {
|
||||||
if (this._config.backdrop === 'static') {
|
|
||||||
const hideEventPrevented = $.Event(EVENT_HIDE_PREVENTED)
|
const hideEventPrevented = $.Event(EVENT_HIDE_PREVENTED)
|
||||||
|
|
||||||
$(this._element).trigger(hideEventPrevented)
|
$(this._element).trigger(hideEventPrevented)
|
||||||
@@ -260,9 +259,6 @@ class Modal {
|
|||||||
})
|
})
|
||||||
.emulateTransitionEnd(modalTransitionDuration)
|
.emulateTransitionEnd(modalTransitionDuration)
|
||||||
this._element.focus()
|
this._element.focus()
|
||||||
} else {
|
|
||||||
this.hide()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_showElement(relatedTarget) {
|
_showElement(relatedTarget) {
|
||||||
@@ -400,7 +396,11 @@ class Modal {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this._config.backdrop === 'static') {
|
||||||
this._triggerBackdropTransition()
|
this._triggerBackdropTransition()
|
||||||
|
} else {
|
||||||
|
this.hide()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
if (animate) {
|
if (animate) {
|
||||||
|
@@ -934,10 +934,10 @@ $(function () {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
QUnit.test('should not close modal when escape key is pressed with keyboard = false and backdrop = static', function (assert) {
|
QUnit.test('should not close modal when escape key is pressed with keyboard = false', function (assert) {
|
||||||
assert.expect(1)
|
assert.expect(1)
|
||||||
var done = assert.async()
|
var done = assert.async()
|
||||||
var $modal = $('<div class="modal" data-backdrop="static" data-keyboard="false"><div class="modal-dialog" /></div>').appendTo('#qunit-fixture')
|
var $modal = $('<div class="modal"><div class="modal-dialog" /></div>').appendTo('#qunit-fixture')
|
||||||
|
|
||||||
$modal.on('shown.bs.modal', function () {
|
$modal.on('shown.bs.modal', function () {
|
||||||
$modal.trigger($.Event('keydown', {
|
$modal.trigger($.Event('keydown', {
|
||||||
@@ -955,7 +955,6 @@ $(function () {
|
|||||||
assert.strictEqual(false, true, 'should not hide the modal')
|
assert.strictEqual(false, true, 'should not hide the modal')
|
||||||
})
|
})
|
||||||
.bootstrapModal({
|
.bootstrapModal({
|
||||||
backdrop: 'static',
|
|
||||||
keyboard: false
|
keyboard: false
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user