fix(modals) Fixing DOM issues with modals

This commit is contained in:
Bruno Alves de Faria authored and Erik Ziegler committed 2018-07-12 12:11:14 +02:00
1 parent 2c790ff674
commit 50374038a3
3 files changed
+24 -5

No files matched your search

@@ -4,6 +4,9 @@ import { _ } from 'meteor/underscore';
import { $ } from 'meteor/jquery';
import { OHIF } from 'meteor/ohif:core';
let zIndexBackdrop = 1060;
let zIndexModal = 1061;
OHIF.ui.showDialog = (templateName, dialogData={}) => {
// Check if the given template exists
const template = Template[templateName];
@@ -49,6 +52,20 @@ OHIF.ui.showDialog = (templateName, dialogData={}) => {
$modal = $node.find('.modal:first');
}
$modal.one('show.bs.modal', function() {
setTimeout(() => {
const $modal = $(this);
const modal = $modal.data('bs.modal');
if (!modal) return;
const { $backdrop } = modal;
if (!$backdrop) return;
$backdrop.css('z-index', zIndexBackdrop);
$modal.css('z-index', zIndexModal);
zIndexBackdrop += 2;
zIndexModal += 2;
});
});
// Destroy the created dialog view when the promise is either resolved or rejected
const dismissModal = (hideFirst=false) => {
if (hideFirst || (dialogData && dialogData.promise && $modal)) {