Tagged: 

Viewing 27 posts - 1 through 27 (of 27 total)
  • Author
    Posts
  • #1220730

    Is there a plan to update the nav to meet accessibility guidelines? I hope so because in the US, we’re required by law to have accessible sites. Anyone who has a site that’s not accessible is open to getting sued.

    I see people have been asking about this since 2016, but nothing has been updated yet. :(

    #1221049

    Hey dfpg,

    What exactly do you need to change, and what are the guidelines?

    Best regards,
    Rikard

    #1221482

    Thanks @Rikard! The guidelines are unfortunately a little vague, but you need to be able to navigate navigation menus without a mouse. Otherwise there’s no way for many people with disabilities to reach your content.

    #1223071

    Hi,

    Sorry for the delay. The main menu is not fully accessible without a mouse, but it’s already inside a nav tag and the menu items are wrapped inside an unordered list, so they should be properly recognized by assistive technologies as described in the documentation and you should be able to navigate using a keyboard.

    // https://www.w3.org/WAI/tutorials/menus/structure/

    If you want to add the role and aria-label attribute to the nav tag, edit the wp-content\themes\enfold\includes\helper-main-menu.php file and look for this code around line 170..

     $main_nav = "<nav class='main_menu' data-selectname='".__('Select a page','avia_framework')."' ".avia_markup_helper(array('context' => 'nav', 'echo' => false)).">";
    

    .., then replace it with:

     $main_nav = "<nav role='navigation' aria-label='Primary'  class='main_menu' data-selectname='".__('Select a page','avia_framework')."' ".avia_markup_helper(array('context' => 'nav', 'echo' => false)).">";
    

    // https://www.w3.org/WAI/WCAG21/Techniques/aria/ARIA6

    We can also add the role attribute to menu items by editing the wp-content\themes\enfold\includes\helper-responsive-megamenu.php, look for this code around line 270:

    $attributes .= ! empty( $item->url )        ? ' href="'   . esc_attr( $item->url        ) .'"' : '';
    

    Below, add the role and tabindex attribute:

    $attributes .= ' role="menuitem" tabindex="0"';
    

    Best regards,
    Ismael

    #1224465

    Thanks @ismael! So there’s no way to make it navigable with the keyboard? Is there a way to use a different menu, not the one built into the theme?

    #1224526

    Hi,

    The menu is already usable with a keyboard, but you can’t use the arrow keys to move to the previous and next menu items, only the Tab key to navigate and space to access the link.

    If you want to use a different menu, other users usually integrate the Ubermenu plugin with the theme in place of the default menu, but we are not really sure if it has accessibility features. It looks like the menu is keyboard accessible based on this article.

    // https://sevenspark.com/docs/ubermenu-3/faqs/accessibility-blue-glow

    Best regards,
    Ismael

    #1224984

    My jQuery isn’t great, but it seems like you could edit the avia-snippet-megamenu.js to respond to focus, as well as hover events. Is that right?

    
    	//bind event for mega menu
    			megaItems.each(function(i){
    
    				$(this).hover(
    
    					function()
    					{
    						delayCheck[i] = true;
    						setTimeout(function(){megaDivShow(i); },options.delay);
    					},
    
    					function()
    					{
    						delayCheck[i] = false;
    						setTimeout(function(){megaDivHide(i); },options.delay);
    					}
    				);
    			});
    
    			// bind events for dropdown menu
    			dropdownItems.find('li').addBack().each(function()
    			{
    				var currentItem = $(this),
    					sublist = currentItem.find('ul:first'),
    					showList = false;
    
    				if(sublist.length)
    				{
    					sublist.css({display:'block', opacity:0, visibility:'hidden'});
    					var currentLink = currentItem.find('>a');
    
    					currentLink.on('mouseenter', function()
    					{
    						sublist.stop().css({visibility:'visible'}).animate({opacity:1});
    					});
    
    					currentItem.on('mouseleave', function()
    					{
    						sublist.stop().animate({opacity:0}, function()
    						{
    							sublist.css({visibility:'hidden'});
    						});
    					});
    
    				}
    
    			});
    
    #1225392

    Well, I bought and implemented the Ubermenu and it’s totally broken. That’s a half day wasted. I’m really starting to get frustrated with this theme. Navigating a website with the keyboard may have been a “feature” several years ago, but it’s a necessity for a modern website. How is a theme this popular so behind on accessibility? Accessibility is the law in my country and this theme doesn’t meet even the most basic of standards. :(

    #1225775

    Hi,

    Sorry for the troubles. The sub menu is already set to respond on hover, focus or mouseenter events but what’s not available is the use of keyboard arrows to navigate back or to the previous and next items. You can still Tab through the navigation or links within the page. Adding this css code should add an indicator that a menu item is active.

    .av-main-nav > li > a:focus, .av-main-nav > li > a:hover {
    	text-decoration: underline;
    }
    

    The Ubermenu plugin has a specific documentation for Enfold. Please check the following documentation.

    // https://sevenspark.com/docs/ubermenu-enfold

    Best regards,
    Ismael

    #1226145

    Ismael,

    What we are looking for is for the sub menu to display when the top level menu item is tabbed to using tab on the keyboard. So if the main menu item has items underneath it, the list of sub-menu items should display just as if I hovered a mouse over the main menu item. From there I can simply keep tabbing down the list.

    To see a working example, go to this page and use tab on your keyboard to cycle through the menu.
    https://open.berkeley.edu/

    Mitch

    #1226270

    Thanks @Ismael. I appreciate you looking into this. Unfortunately, this doesn’t help people using screen readers. The visibility is hidden, which means it’s hidden from screen readers too. That means that blind people are unable to navigate any Enford site. That’s _exactly_ what makes _al_l of us open to lawsuits.

    It’s 2020. Maybe 7 years ago when this theme was created accessibility was an optional feature. It’s not anymore. This theme has been in the top sellers list for years, meaning it’s made millions and millions from us, your customers. With that kind of money, you can afford to keep your theme up to date with the most basic of legal requirements.

    #1226327

    Hi,

    Thank you for the clarifications.

    To make the sub menu visible on tab focus, please edit the file that Lance mentioned above (avia-snippet-megamenu.js), look for this block of code..

    	currentLink.on('mouseenter', function () {
    						sublist.stop().css({ visibility: 'visible' }).animate({ opacity: 1 });
    					});
    

    .. and replace it with:

    	currentLink.on('mouseenter', function () {
    						sublist.stop().css({ visibility: 'visible' }).animate({ opacity: 1 });
    					});
    
    					currentLink.on('focus', function () {
    						sublist.stop().css({ visibility: 'visible' }).animate({ opacity: 1 });
    
    						sublist.find('li:last-child').on('focusout', function () {
    							sublist.stop().animate({ opacity: 0 }, function () {
    								sublist.css({ visibility: 'hidden' });
    							});
    						});
    					});
    
    

    And add this css if you want to see an indicator:

    #top .av-main-nav ul a:focus {
    	text-decoration: underline;
    }

    This should open the sub menu on tab focus and hide it back after focusing out on the very last menu item in the list. This should work properly on items with single sub menu, but not on items with multiple levels of child menu items.

    We’ll forward the issue to our channel.

    Best regards,
    Ismael

    #1226528

    Thank you Ismael,

    How can I get this into a child theme so the changes aren’t overwritten with the next release?

    Mitch

    #1226624

    Hmm. I can get the CSS working, though mine is a little different than yours.

    
    #top .av-main-nav a:focus {
    	text-decoration: underline!important;
    }
    

    As for the focus, still no luck for me. Does this look right? It doesn’t seem to have an effect on the menu’s behavior.
    asdf

    @mitchell Here’s how I did it:
    1. Follow the docs to create a child theme: https://kriesi.at/documentation/enfold/child-theme/.
    2. Copy the file from enfold/js/avia-snippet-megamenu.js to enfold-child/avia-snippet-megamenu.js. After you do this, you should be able to see the avia-snippet-megamenu.js under Appearance/Theme Editor in the right sidebar.
    3. From there, make the changes that Ishmael listed above.

    • This reply was modified 4 years, 4 months ago by dfpg.
    #1226627

    dfpg,

    The only way I could get it to work was to modify the parent theme file. Recreating the structure/file in my child theme wouldn’t take. The supplied code works. Now it’s just a parent/child issue.

    Mitch

    #1227447

    Hi,


    @dfpg
    : Is the Performance > File Compression settings enabled? Try to disable it temporarily and make sure that the scripts are not cached.

    @Mitch: We might have to dequeue the original script, copy it to the child theme, then enqueue it back using the new path or directory.

    avia_enqueue_script_conditionally( $condition , 'avia-megamenu', $template_url."/js/avia-snippet-megamenu.js", array('avia-default'), $vn, true);
    

    // https://developer.wordpress.org/reference/functions/wp_dequeue_script/
    // https://developer.wordpress.org/reference/functions/wp_enqueue_script/

    Best regards,
    Ismael

    #1227464

    Thank you for your help Ismael,

    I got the following to work for me:

    
    
    wp_dequeue_script('avia-megamenu');
    wp_enqueue_script('avia-megamenu', get_stylesheet_directory_uri().'/js/avia-snippet-megamenu.js', array('avia-default'), '', true);
    #1227611

    @ishmael It seems to ignore any changes I make to the JS file. Just for testing I’ve added console.log('blah') to the currentLink.on('mouseenter', function. Even deleting the JS file from the main and child theme has no effect. Is it possible I have some setting telling it to use a different menu? Thanks.

    #1227679

    Hey!


    @dfpg
    : I forgot that you”ve enabled the Ubermenu plugin. Sorry about that. Is it still enabled? Unfortunately, the modification above will only work for the theme’s default menu. We might have to modify a different script for the Ubermenu plugin.

    @Mitch: Thank you for the info.

    Regards,
    Ismael

    #1228454

    @ishmail Thanks. No, I got rid of that already. I’m just using the regular Enfold menu.

    #1229335

    Oops, pinged the wrong username. :) @Ismael

    #1229369

    Hi,


    @dfpg
    : Thank you for the update. So is it working for you now? If it still doesn’t work, post the login details in the private field so that we can check the site. Also, please make sure that the Appearance > Editor panel is accessible so that we can edit the files if necessary.

    Best regards,
    Ismael

    #1230175

    Thanks @ishmael

    #1230448

    I meant @ismael :)

    #1230845

    Hi,

    We tried to modify the files via the Appearance > Editor panel but we always get an error.

    Unable to communicate back with site to check for fatal errors, so the PHP change was reverted. You will need to upload your PHP file change by some other means, such as by using SFTP.

    We might have to access the file server directly. Please post the SFTP login details in the private field.

    It probably doesn’t work yet because the /js/avia-snippet-megamenu.js in the child theme is not yet registered. So to register the script, look for the av_dequeue_child_stylecss function inside the child theme’s functions.php file, then place this snippet.

    wp_dequeue_script('avia-megamenu');
    wp_enqueue_script('avia-megamenu', get_stylesheet_directory_uri().'/js/avia-snippet-megamenu.js', array('avia-default'), '', true);
    

    You can also create a new wp_enqueue_scripts hook if you don’t want to mix JS with the CSS files.

    Thank you for your patience.

    Best regards,
    Ismael

    #1231491

    @ismael That did it, thank you for sticking with me through all that!!!

    #1231942

    Hi,

    You’re welcome! Glad it worked. Please don’t hesitate to open a new thread if you need anything else.

    Have a nice day.

    Best regards,
    Ismael

Viewing 27 posts - 1 through 27 (of 27 total)
  • The topic ‘Accessibility issues with main nav leaves US sites in danger of lawsuits :(’ is closed to new replies.