/* Omeka Berlin theme globals -- patched for WCAG 2.2 AA in the static archive. * * Two changes from the theme as shipped, both SC 2.1.1 Keyboard failures that * between them left a keyboard user unable to reach parts of the navigation at * ANY viewport width: * * 1. dropDown() prepended `Menu` -- an anchor with no * href, which is neither focusable nor Enter-operable -- and then hid * #mobile-nav .navigation. Below 768px #primary-nav is display:none * (style.css:1954), so that opener was the ONLY route to the site * navigation. It is a real '); var opener = $('#advanced-search'); advancedForm.click(function (event) { event.stopPropagation(); }); function close() { advancedForm.fadeOut(); opener.attr('aria-expanded', 'false'); } opener.click(function (event) { event.preventDefault(); event.stopPropagation(); var open = opener.attr('aria-expanded') === 'true'; advancedForm.fadeToggle(); opener.attr('aria-expanded', open ? 'false' : 'true'); if (!open) { $(document).on('click.advancedForm', function (event) { if (event.target.id === 'query') { return; } close(); $(document).off('click.advancedForm'); }); } }); /* 2.1.1 / 1.4.13: dismissible without moving the pointer, and focus goes back to the control that opened it. */ $(document).on('keydown', function (event) { if (event.key === 'Escape' && opener.attr('aria-expanded') === 'true') { close(); opener.focus(); } }); } else { $('#search-form input[type=submit]').addClass("blue button"); } }; Omeka.dropDown = function () { var dropdownMenu = $('#mobile-nav'); if (!dropdownMenu.length) { return; } var list = $('#mobile-nav .navigation'); /* retrofit.py gives the list this id so aria-controls can point at it; fall back to setting it here if that ever stops being true. */ if (!list.attr('id')) { list.attr('id', 'mobile-nav-list'); } dropdownMenu.prepend( ''); list.hide(); $('#mobile-nav > button.menu').click(function () { var button = $(this); var open = button.attr('aria-expanded') === 'true'; if (open) { list.slideUp(); } else { list.slideDown(); } button.attr('aria-expanded', open ? 'false' : 'true'); }); }; })(jQuery);