Fixed multiple bootstrap modal focus error.

This commit is contained in:
buddha87 2016-11-08 17:38:13 +01:00
parent 33684cba58
commit d0c82ec115

View File

@ -128,7 +128,8 @@ function HashTable(obj) {
$.fn.modal.Constructor.prototype.enforceFocus = function () {
var that = this;
$(document).on('focusin.modal', function (e) {
if ($(e.target).hasClass('select2-input') || $(e.target).hasClass('select2-search__field') || $(e.target).hasClass('hexInput') ) {
var $target = $(e.target);
if ($target.hasClass('select2-input') || $target.hasClass('select2-search__field') || $target.hasClass('hexInput') ) {
return true;
}
@ -136,6 +137,11 @@ $.fn.modal.Constructor.prototype.enforceFocus = function () {
if ($parent.hasClass('cke_dialog_ui_input_select') || $parent.hasClass('cke_dialog_ui_input_text')) {
return true;
}
// Allow stacking of modals
if($target.closest('.modal.in').length) {
return true;
}
if (that.$element[0] !== e.target && !that.$element.has(e.target).length) {
that.$element.focus();