From ba50e5cc8561f92407de596484604d9c38dec2e2 Mon Sep 17 00:00:00 2001 From: sfisher Date: Thu, 14 Nov 2024 14:06:15 -0800 Subject: [PATCH] temp commit for menus. --- dev/js/main2.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/dev/js/main2.js b/dev/js/main2.js index 37b971b7e..9d2fa4d5b 100755 --- a/dev/js/main2.js +++ b/dev/js/main2.js @@ -6,18 +6,20 @@ $(document).ready(function(){ // Before toggling menu, change default header menu class to non-selected state and change default aria attribute: + // According to ChatGPT using aria-hidden for visual appearance isn't recommended and items should not be hidden from + // screen readers. Instead, use aria-expanded to indicate the state of the menu. $('#js-header__nav').attr('class', 'header__nav'); - $('#js-header__nav').attr('aria-hidden', 'true'); + $('#js-header__nav').attr('aria-expanded', 'false'); // Toggle classes and attributes: $('#js-header__nav-button').click(function(){ $('#js-header__nav').toggleClass('header__nav header__nav--selected', 300, 'easeInOutCubic'); - if($('#js-header__nav').attr('aria-hidden') == 'true') { - $('#js-header__nav').attr('aria-hidden', 'false'); + if($('#js-header__nav').attr('aria-expanded') == 'false') { + $('#js-header__nav').attr('aria-expanded', 'true'); } else { - $('#js-header__nav').attr('aria-hidden', 'true'); + $('#js-header__nav').attr('aria-hidden', 'false'); } }); @@ -62,18 +64,25 @@ $(document).ready(function(){ // Toggle open and closed from login button $('#js-header__loginout-button').click(function(){ + if ($('#js-login-modal').attr('aria-hidden') == 'true') { + $('#js-login-modal').attr('aria-hidden', 'false'); + }else { + $('#js-login-modal').attr('aria-hidden', 'true'); + } $('#js-login-modal').fadeToggle(200); }); // Close when close icon is clicked $('#js-login-modal__close').click(function(){ + $('#js-login-modal').attr('aria-hidden', 'true'); $('#js-login-modal').fadeToggle(200); }); // Close when form is submitted $('#js-login-modal__form').submit(function(){ + $('#js-login-modal').attr('aria-hidden', 'true'); $('#js-login-modal').fadeToggle(200); });