Merge pull request #1362 from gabsource/fix-sweetalert

Disable SweetAlert forced focus when a Bootstrap modal is already open in back-end
This commit is contained in:
Samuel Georges 2015-08-15 09:31:23 +10:00
commit 9ebd084e89
1 changed files with 7 additions and 1 deletions

View File

@ -386,7 +386,13 @@
function handleOnBlur(e) {
var $targetElement = e.target || e.srcElement,
$focusElement = e.relatedTarget,
modalIsVisible = hasClass(modal, 'visible');
modalIsVisible = hasClass(modal, 'visible'),
bootstrapModalIsVisible = document.querySelector('.control-popup.modal') || false;
if(bootstrapModalIsVisible) {
// Bootstrap will enforce focus on the existing model, so don't do anything here to prevent infinite loop
return;
}
if (modalIsVisible) {
var btnIndex = -1; // Find the button - note, this is a nodelist, not an array.