mirror of
https://github.com/tenrok/bootstrap.git
synced 2026-06-17 19:21:23 +03:00
Hopefully a fix for #12364
* register the callback before invoking the toggling * listen for `hidden` instead of `hide` * account for the possibility of the associated `show` event being preventDefault-ed Adds relevant unit tests.
This commit is contained in:
+6
-3
@@ -268,10 +268,13 @@
|
||||
|
||||
if ($this.is('a')) e.preventDefault()
|
||||
|
||||
Plugin.call($target, option, this)
|
||||
$target.one('hide.bs.modal', function () {
|
||||
$this.is(':visible') && $this.trigger('focus')
|
||||
$target.one('show.bs.modal', function (showEvent) {
|
||||
if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown
|
||||
$target.one('hidden.bs.modal', function () {
|
||||
$this.is(':visible') && $this.trigger('focus')
|
||||
})
|
||||
})
|
||||
Plugin.call($target, option, this)
|
||||
})
|
||||
|
||||
}(jQuery);
|
||||
|
||||
Reference in New Issue
Block a user