- This topic has 7 replies, 3 voices, and was last updated 3 years, 2 months ago by
David.
-
AuthorPosts
-
February 22, 2023 at 12:47 pm #2543135
Babi
According to accessibility audits, the text in GeneratePress footer widgets is not included in an ARIA landmark. As I understand the ARIA guidelines, this would not be the case if the footer widget bar was inside the <footer> tag. But I could alternatively add an ARIA-role attribute to the footer widget bar, as explained here: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/contentinfo_role
But I don’t know how to do this–I am using a child theme, but I can’t find the file that generates the footer widget bar.
Currently the theme has
<div id="footer-widgets" class="site footer-widgets">What I’m after is something like
<div id="footer-widgets" class="site footer-widgets" role="contentinfo">What’s the best way to do this?
February 22, 2023 at 7:45 pm #2543410Fernando Customer Support
Hi Babi,
The file is called
footer.php. It’s in folder inc/structure. That specific line is in line166.You can edit the code there if that’s what you’re looking to do.
February 23, 2023 at 7:54 am #2544178Babi
Well, first of all I can’t believe I missed that file–I didn’t scroll down far enough, I guess.
But now that I’ve copied the file into /child-theme/inc/structure and edited the ‘<div id=”footer-widgets”‘ line, my edits are not shown on the site. Do I misunderstand how the template override works? Is there a better way of accomplishing what I’m after?
Thanks.
February 23, 2023 at 5:51 pm #2544752Fernando Customer Support
Unfortunately, there’s no filter that we can use for that so this may be the only way to do what you want.
What’s the exact audit report about this ARIA role issue?
Can you provide the link to the site in question? I’ll check if it’s just cached.
You may use the Private Information field for this: https://docs.generatepress.com/article/using-the-premium-support-forum/#private-information
February 24, 2023 at 6:34 am #2545459Babi
I have added the URL and some temporary site credentials to the Private information field.
February 24, 2023 at 10:00 am #2545797David
StaffCustomer SupportHi there,
remove your child theme footer.php and instead use this function:
add_filter( 'generate_parse_attr', function( $attributes, $context ) { if ( 'footer-widgets-container' === $context ) { $attributes['role'] = "contentinfo"; } return $attributes; }, 10, 2 );It will add the role to the container that wraps the widgets.
February 24, 2023 at 11:38 am #2545913Babi
Brilliant. Thanks very much.
February 25, 2023 at 4:43 am #2546396David
StaffCustomer SupportYou’re welcome
-
AuthorPosts
- You must be logged in to reply to this topic.