-
usethebitcoin
Hi GP Team!
In our mobile view we have this tabs options and inside of it are some articles. Since I am fixing the pageinsights issues, I notice that my code was not working.
document.getElementById('ub-tabbed-content-bd89f598-5d75-4a30-a115-827455285c3a-tab-0').setAttribute('aria-label', 'Editors Choice Tab')
It was showing in the header but was not appending where I wanted to append the aria-label. The id was correct.
Pls refer to the image below.
https://i.postimg.cc/TwFD5byV/Screenshot-42.jpgThanks for your help
-
Hi there,
try adding your script to the
wp_footer
.
This means the script will fire AFTER the HTML has been loaded on the page. -
usethebitcoin
Hi David,
Thank you; it worked. I thought this might solve some of the issues from PageInsights, since aria-label was missing.
Assistive technologies, like screen readers, can’t interpret ARIA attributes with invalid values.
https://i.postimg.cc/Sxx5hXWm/Screenshot-43.jpgWhat is you suggestion about this? I have read some past topics about this, but how to really solve this issue?
-
Have you spoken to the Tab plugin developer ?
I can’t say what google specifically doesn’t like about that particular HTML element. It could be the following issue I see:
Here is the HTML for the tabpanel.
And it contains aaria-labelledby
attribute:aria-labelledby="ub-tabbed-content--tab-0"
<div role="tabpanel" class="wp-block-ub-tabbed-content-tab-content-wrap active editors-choice-tab" id="ub-tabbed-content--panel-0" aria-labelledby="ub-tabbed-content--tab-0" tabindex="0">
And that attribute ID should correspond to the labelling element, which would be the
tab
element:<div role="tab" id="ub-tabbed-content-56c2d3a7-a186-4d35-97f3-9ef52ffd93f5-tab-0" aria-controls="ub-tabbed-content-56c2d3a7-a186-4d35-97f3-9ef52ffd93f5-panel-0" aria-selected="true" class="wp-block-ub-tabbed-content-tab-title-wrap active" tabindex="0"><div class="wp-block-ub-tabbed-content-tab-title">Editor’s Choice</div></div>
But the tab ID does not match the tabpabels aria-labelledby.
And that needs to be fixed at source by the plugin developer.
- You must be logged in to reply to this topic.