CRM-14170 - BugFix for closing help dialog when clicked rapidly
[civicrm-core.git] / js / Common.js
index 552ff5af568d488922f64005d4f84174a0a87936..dd5498f557fe0bd584d0575d608a0b4fc8b699df 100644 (file)
@@ -429,12 +429,13 @@ CRM.validate = CRM.validate || {
 
   var helpDisplay, helpPrevious;
   CRM.help = function (title, params, url) {
-    if (helpDisplay && helpDisplay.isOpen) {
-      helpDisplay.close();
+    if (helpDisplay && helpDisplay.close) {
       // If the same link is clicked twice, just close the display - todo use underscore method for this comparison
-      if (helpPrevious === JSON.stringify(params)) {
+      if (helpDisplay.isOpen && helpPrevious === JSON.stringify(params)) {
+        helpDisplay.close();
         return;
       }
+      helpDisplay.close();
     }
     helpPrevious = JSON.stringify(params);
     params.class_name = 'CRM_Core_Page_Inline_Help';