Change aria label of Close Off Canvas Content

Hi,

How can I change the aria label of the Off Canvas close button?

Now it says: “Close Off Canvas Content”. For the hamburger menu I used Toggle custom attributes to change the aria-label.

Thank you.

Hello @Timmid,

Thanks for writing to us

Please have a look at this video tutorial to learn more about how to change the aria-label of the element.

Thanks

Hi Prakash,

Thx for the reply.

I can change the aria-label for the mobile menu button the way the video describes. Only I need to change the aria-label of the close X “button”. So people with screen readers know how to close the mobile menu.

Hello @Timmid,

I would suggest you please add this code to the active child theme functions.php file. Please feel free to change the custom text as per your requirements.

function change_aria_label($translated) { 
  $translated = str_ireplace('Close Off Canvas Content', 'custom_text', $translated);
  
  return $translated; 
}
add_filter('gettext', 'change_aria_label' );

The code above serves as an example code. Feel free to modify it when needed. Please note that custom coding is beyond the scope of our support. You will have to maintain any custom coding to make sure that it will still work after any updates or does not create any issues or incompatibility in the future.

Be advised that custom coding is beyond the scope of our support under our Support Policy. If you are unfamiliar with code and resolving potential conflicts, you may select our One service for further assistance.

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.