bring in line with #24176
[civicrm-core.git] / js / crm.wordpress.js
index 774b24a35fd0a3b52189bbf0b19b190dfd1516af..81b433e65f19169439085017bfd25846d5e71ca3 100644 (file)
@@ -1,16 +1,6 @@
 // http://civicrm.org/licensing
 CRM.$(function($) {
   $(document)
-    .on('dialogopen', function(e) {
-      // Make admin bar hide behind popup windows
-      $('#adminmenuwrap').css('z-index', '100');
-    })
-    .on('dialogclose', function(e) {
-      if ($('.ui-dialog-content:visible').not(e.target).length < 1) {
-        // Restore admin bar position
-        $('#adminmenuwrap').css('z-index', '');
-      }
-    })
     .on('crmWysiwygCreate', function(e, type, editor) {
       if (type === 'ckeditor') {
         editor.on('maximize', function(e) {
@@ -18,4 +8,20 @@ CRM.$(function($) {
         });
       }
     });
+  // Prevent screen reader shortcuts from changing the document hash and breaking angular routes
+  $('a.screen-reader-shortcut').click(function() {
+    var target = $(this).attr('href');
+    // Show toolbar if hidden
+    if (target === '#wp-toolbar' && CRM.menubar.position === 'over-cms-menu') {
+      CRM.menubar.togglePosition(false);
+    }
+    $(target).focus();
+    return false;
+  });
+  $('<a href="#crm-qsearch-input" class="screen-reader-shortcut">' + ts("Open CiviCRM Menu") + '</a>')
+    .prependTo('#adminmenumain')
+    .click(function() {
+      CRM.menubar.open('Home');
+      return false;
+    });
 });