Add body class when dialog is open
authorColeman Watts <coleman@civicrm.org>
Tue, 16 Apr 2019 17:33:05 +0000 (13:33 -0400)
committerColeman Watts <coleman@civicrm.org>
Tue, 16 Apr 2019 20:08:49 +0000 (16:08 -0400)
This should make it easier for reacting to the presence of a dialog with css.

js/Common.js

index 6a06cff714e7a7a10d488d00da4c58b9aa3e9681..e2714c33b0ec996c73f36f564639a5caed1b461b 100644 (file)
@@ -927,6 +927,7 @@ if (!CRM.vars) CRM.vars = {};
     })
     .on('dialogopen', function(e) {
       var $el = $(e.target);
+      $('body').addClass('ui-dialog-open');
       // Modal dialogs should disable scrollbars
       if ($el.dialog('option', 'modal')) {
         $el.addClass('modal-dialog');
@@ -961,6 +962,9 @@ if (!CRM.vars) CRM.vars = {};
       if ($('.ui-dialog .modal-dialog:visible').not(e.target).length < 1) {
         $('body').css({overflow: ''});
       }
+      if ($('.ui-dialog-content:visible').not(e.target).length < 1) {
+        $('body').removeClass('ui-dialog-open');
+      }
     })
     .on('submit', function(e) {
       // CRM-14353 - disable changes warn when submitting a form