
Tagged: Screenreader
-
AuthorPosts
-
June 26, 2025 at 1:09 pm #1485950
Hi,
We observed duplicate id-attributes in the mobile menu (hamburger-menu), similar to what is described in
This came up when trying to check and optimize website-compatiblity for screenreaders. Nodes of the main menu are copied over to the hamburger-menu. svg-icons (for the search) contain id-attributes which simply get duplicated – but obviously need to be transformed to become unique again.
A modification of this copy-behaviour would for example be possible in
wp-content/themes/enfold/js/avia-snippet-hamburger-menu.js
in function normalize_layout().Quick-and-dirty code for those replacements:
There was:
var menu2 = $(‘#header .main_menu’).clone(true),
ul = menu2.find(‘ul.av-main-nav’),
id = ul.attr(‘id’);We then added lines to search for the corresponding nodes in the HTML with jQuery and make replacements for all hits. ‘-hamburger’ is appended to the IDs.
var toChange;
toChange = menu2.find(‘[id^=av-svg-desc-‘);
toChange.each(function() {
$(this).attr(‘id’, $(this).attr(‘id’) + ‘-hamburger’);
});
toChange = menu2.find(‘[id^=av-svg-title-‘);
toChange.each(function() {
$(this).attr(‘id’, $(this).attr(‘id’) + ‘-hamburger’);
});
toChange = menu2.find(‘[aria-labelledby^=av-svg-title-‘);
toChange.each(function() {
$(this).attr(‘aria-labelledby’, $(this).attr(‘aria-labelledby’) + ‘-hamburger’);
});
toChange = menu2.find(‘[aria-describedby^=av-svg-desc-‘);
toChange.each(function() {
$(this).attr(‘aria-describedby’, $(this).attr(‘aria-describedby’) + ‘-hamburger’);
});It’s quite an edge case, but could potentially irritate a screen reader.
June 26, 2025 at 7:04 pm #1485967Hey jugalbandi3,
The thread you linked to is 8 years old, if it was a problem then, it would have been fixed by now. Where can we see the actual problem on your site?
Best regards,
RikardJune 26, 2025 at 8:00 pm #1485976Hi Rikard,
Thank you for your reply!
We had the problem with the current Enfold version: 7.1, and came across the old post while looking for a solution.
We then solved the problem in a development environment as described and posted the article here if anyone else has the same problem.
Perhaps there will also be an adjustment in Enfold itself in the next update.Best regards,
jugalbandi3June 28, 2025 at 3:58 pm #1486078Hi,
Thank you for sharing your solution, but when I test our demo there are no IDs added to the mobile menu items, unless you mean a menu link with an ID to an anchor on the page. I tested in WAVE and found no errors for IDs.
If you mean the link IDs to anchors on the page, note that the mobile menu is not created until the menu is clicked, nonetheless since most people use the same link IDs on their page for mobile and desktop, this would break their links.
Since I can not reproduce your issue and this is beyond what we can do here, you are welcome to open a Github Feature Request to place a request and follow it as the Dev Team reviews it.Best regards,
Mike -
AuthorPosts
- You must be logged in to reply to this topic.