This commit is contained in:
Jacob Thornton 2013-05-24 23:53:44 -07:00
parent f3e45c3778
commit e424b3879c
3 changed files with 9 additions and 7 deletions

View File

@ -835,7 +835,6 @@
transition ? transition ?
that.$element.one($.support.transition.end, function () { that.$element.focus().trigger('shown.bs.modal') }) : that.$element.one($.support.transition.end, function () { that.$element.focus().trigger('shown.bs.modal') }) :
that.$element.focus().trigger('shown.bs.modal') that.$element.focus().trigger('shown.bs.modal')
}) })
} }
@ -864,7 +863,9 @@
} }
Modal.prototype.enforceFocus = function () { Modal.prototype.enforceFocus = function () {
$(document).on('focusin.bs.modal', function (e) { $(document)
.off('focusin.bs.modal') // guard against infinite focus loop
.on('focusin.bs.modal', function (e) {
if (this.$element[0] !== e.target && !this.$element.has(e.target).length) { if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
this.$element.focus() this.$element.focus()
} }

File diff suppressed because one or more lines are too long

View File

@ -76,7 +76,6 @@
transition ? transition ?
that.$element.one($.support.transition.end, function () { that.$element.focus().trigger('shown.bs.modal') }) : that.$element.one($.support.transition.end, function () { that.$element.focus().trigger('shown.bs.modal') }) :
that.$element.focus().trigger('shown.bs.modal') that.$element.focus().trigger('shown.bs.modal')
}) })
} }
@ -105,7 +104,9 @@
} }
Modal.prototype.enforceFocus = function () { Modal.prototype.enforceFocus = function () {
$(document).on('focusin.bs.modal', function (e) { $(document)
.off('focusin.bs.modal') // guard against infinite focus loop
.on('focusin.bs.modal', function (e) {
if (this.$element[0] !== e.target && !this.$element.has(e.target).length) { if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
this.$element.focus() this.$element.focus()
} }