Tagged: accessibility, subnav
-
AuthorPosts
-
September 22, 2023 at 1:04 am #1419966
Current:
<ul id=”menu-mymenu” class=”av-subnav-menu”>With role tag added:
<ul id=”menu-mymenu” class=”av-subnav-menu” role=”menu”>The menu items correctly implement the role=”menuitem”, but that element requires a parent element, the
- to have role=”menu”.
September 22, 2023 at 7:51 am #1419994Hey davidkfry,
Thank you for the inquiry.
Please add this script in the functions.php file to apply the role attribute to the submenu container.
function av_custom_inline_script() { // apply role menu to subnav wp_add_inline_script( 'jquery', " (function($) { $('.av-subnav-menu').attr('role', 'menu'); })(jQuery); " ); } add_action( 'wp_enqueue_scripts', 'av_custom_inline_script' );
Best regards,
IsmaelSeptember 23, 2023 at 12:18 am #1420088I would love to see this addressed so that the generated HTML doesn’t need JS hacks like this.
Thanks that solution got me pretty close. It needed a document ready to work.
function av_custom_inline_script()
{
// apply role menu to subnav
wp_add_inline_script( ‘jquery’,
”
(function($) {
$( document ).ready( function() {
$(‘.av-subnav-menu’).attr(‘role’, ‘menu’);
$(‘#scroll-top-link’).attr(‘tabindex’, ‘-1’);
})
})(jQuery);
”
);
}
add_action( ‘wp_enqueue_scripts’, ‘av_custom_inline_script’ );September 23, 2023 at 2:52 pm #1420114Hi,
Thank you for reporting this.
Both fixes will be added to next release 5.6.7.
If you want you can replace the following 2 files:
enfold\footer.php
enfold\config-templatebuilder\avia-shortcodes\menu\menu.phpwith
https://github.com/KriesiMedia/enfold-library/blob/master/temp_fixes/Enfold_5_6_6/footer.php
https://github.com/KriesiMedia/enfold-library/blob/master/temp_fixes/Enfold_5_6_6/config-templatebuilder/avia-shortcodes/menu/menu.phpDo not forget to make a backup of the original files for a fallback.
Best regards,
Günter -
AuthorPosts
- You must be logged in to reply to this topic.