Archived topic
W3.org validation errors
25 replies · Started by Harris on February 26, 2018
You could try, but 2.0 was a major version change, so there's no guarantees that it will work.
You could try adding this line to your custom functions:
remove_filter( 'nav_menu_item_title', 'generate_dropdown_icon_to_menu_link', 10, 4 );
Thanks for your assistance Tom.
No problem - did that code work?
I just tried the code, adding it as a snippet, but the "error" was still there.
I also tried replacing the navigation.php file with the one of version 1.4
The old "error" has gone, but now I am getting a new one
Error: An element with the attribute role=button must not appear as a descendant of the a element.
From line 134, column 155; to line 134, column 225
<span role="button" class="dropdown-menu-toggle" aria-expanded="false"></span>
I'm comming back on that
with the code in the originall v2 file, altered on line 227 as follows:
$title = $title . '<span role="main" class="dropdown-menu-toggle" aria-expanded="false"></span>';
(changed role to "main" and totally removed "tabindex")
The menu seems to be working and w3 validation shows no "errors"
Not sure though how this change might interract with the rest of the theme code or later changes to the menu layout etc.
The easiest thing to do is use the current navigation.php, and remove this:
' . $tabindex . '
From this line: https://github.com/tomusborne/generatepress/blob/2.0.2/inc/structure/navigation.php#L227
Hello,
The changes I made were to the current navigation.php file.
After removing the " . $tabindex . " (that is what you proposed too) another "error" was produced saying
Error: An element with the attribute role=button must not appear as a descendant of the a element.
That's why I also had to change the role "button" to "main" in order to bypass that error too.
You can just remove the role completely - we'll be going a different direction in the next version.
I tried removing it before changing it, but it again produces an error if I remove it completely.
Element span is missing one or more of the following attributes: role.
From line 134, column 155; to line 134, column 212
<span class="dropdown-menu-toggle" aria-expanded="false"></span>
Interesting, then I suppose you need the role. In the next version, the span won't be there anymore.
It seems to be working fine now and I get no errors. So I will keep it like that untill the inspection and after that I will either update if a new version is out or I will replace with the initial file.
Thanks for your assistance Tom!
No problem!