From d0c82ec11515acc7cc014fc83138169a6b5d0ba5 Mon Sep 17 00:00:00 2001 From: buddha87 <mail@jharrer.de> Date: Tue, 8 Nov 2016 17:38:13 +0100 Subject: [PATCH] Fixed multiple bootstrap modal focus error. --- js/app.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/js/app.js b/js/app.js index dbc92d2f12..6f30edec01 100644 --- a/js/app.js +++ b/js/app.js @@ -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();