353da0efd7a5e331086b109f5ea4a14c30854269
Merge parents 687677c1289 1b0a3eedc6f
lrnassar
  Wed Mar 18 14:04:15 2026 -0700
Fix skip nav link appearing in hgc popups: use tabindex=-1 to prevent auto-focus, with JS in jquery.plugins.js to enable the link on first Tab keypress. Reverts :focus-visible approach which didn't work due to browser auto-focus being treated as keyboard focus. refs #37252

diff --cc src/hg/js/jquery.plugins.js
index fcbeb81d373,fcbeb81d373..7633ff8631f
--- src/hg/js/jquery.plugins.js
+++ src/hg/js/jquery.plugins.js
@@@ -153,30 -153,30 +153,39 @@@
        // Disable drop shadows.
        dropShadows: false,
        // Mouse delay.
        delay: 800,
        // Animation speed.
        speed: 1
      });
      $('ul.nice-menu ul').css('display', 'none');
    });
  })(jQuery);
  
  
  // Keyboard accessibility for menu bar disclosure buttons (WCAG 2.1)
  (function ($) {
    $(document).ready(function() {
++    // Enable skip nav link on first Tab keypress (starts with tabindex=-1 to prevent
++    // auto-focus in popup windows like hgc from making it visible)
++    $(document).one('keydown', function(e) {
++      if (e.key === 'Tab') {
++        var $skip = $('a.skipNav');
++        if ($skip.length) $skip.removeAttr('tabindex');
++      }
++    });
++
      var $menu = $('ul.nice-menu');
      if (!$menu.length) return;
      var suppressFocus = false; // prevent focus handler from interfering with click/escape
  
      // Track mouse clicks so focus handler can distinguish Tab from click
      $menu.on('mousedown', 'li.menuparent > button', function() {
        suppressFocus = true;
      });
  
      // Toggle dropdown when a disclosure button is clicked (Enter/Space/click)
      $menu.on('click', 'li.menuparent > button', function(e) {
        e.preventDefault();
        suppressFocus = false;
        var $li = $(this).parent();
        var isOpen = $li.hasClass('over');