Tagged: accessibility
-
AuthorPosts
-
June 9, 2020 at 6:19 am #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. :(
June 10, 2020 at 6:18 am #1221049Hey dfpg,
What exactly do you need to change, and what are the guidelines?
Best regards,
RikardJune 11, 2020 at 2:43 am #1221482Thanks @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.
June 16, 2020 at 3:27 pm #1223071Hi,
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,
IsmaelJune 22, 2020 at 4:38 am #1224465Thanks @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?
June 22, 2020 at 9:57 am #1224526Hi,
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,
IsmaelJune 24, 2020 at 2:44 am #1224984My 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'}); }); }); } });
June 25, 2020 at 2:48 am #1225392Well, 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. :(
June 26, 2020 at 11:54 am #1225775Hi,
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,
IsmaelJune 27, 2020 at 11:18 pm #1226145Ismael,
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
June 29, 2020 at 2:10 am #1226270Thanks @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.
June 29, 2020 at 9:04 am #1226327Hi,
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,
IsmaelJune 29, 2020 at 5:24 pm #1226528Thank you Ismael,
How can I get this into a child theme so the changes aren’t overwritten with the next release?
Mitch
June 30, 2020 at 12:29 am #1226624Hmm. 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.
@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 fromenfold/js/avia-snippet-megamenu.js
toenfold-child/avia-snippet-megamenu.js
. After you do this, you should be able to see theavia-snippet-megamenu.js
underAppearance/Theme Editor
in the right sidebar.
3. From there, make the changes that Ishmael listed above.- This reply was modified 4 years, 5 months ago by dfpg.
June 30, 2020 at 12:51 am #1226627dfpg,
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
July 2, 2020 at 12:13 pm #1227447Hi,
@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,
IsmaelJuly 2, 2020 at 12:40 pm #1227464Thank 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);
July 3, 2020 at 3:29 am #1227611@ishmael It seems to ignore any changes I make to the JS file. Just for testing I’ve added
console.log('blah')
to thecurrentLink.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.July 3, 2020 at 7:22 am #1227679Hey!
@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,
IsmaelJuly 7, 2020 at 1:24 am #1228454@ishmail Thanks. No, I got rid of that already. I’m just using the regular Enfold menu.
July 10, 2020 at 7:41 am #1229335Oops, pinged the wrong username. :) @Ismael
July 10, 2020 at 10:35 am #1229369Hi,
@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,
IsmaelJuly 14, 2020 at 6:55 am #1230175Thanks @ishmael
July 14, 2020 at 10:12 pm #1230448I meant @ismael :)
July 16, 2020 at 7:08 am #1230845Hi,
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,
IsmaelJuly 19, 2020 at 12:11 am #1231491@ismael That did it, thank you for sticking with me through all that!!!
July 21, 2020 at 5:44 am #1231942 -
AuthorPosts
- The topic ‘Accessibility issues with main nav leaves US sites in danger of lawsuits :(’ is closed to new replies.