WordPress website passed an automated accessibility test without any issues. At least, the result page displayed a perfect score – 0 issues found.

However, the road to it has been a little interesting.

Initially, there have been 8 problems reported. Two of them were related to heading levels, six to ARIA landmarks in page structure.

Digging into HTML code and trying to understand what is going on, we found out that one of the reported h6 elements had been replaced with div earlier.

The scan was already outdated.

After starting a new scan, we got only 3 warnings left. All three of them have been detected in WordPress components, not the website content itself.

Let's take a look at these 3 warnings one by one.

Warning #1: Kadence aside

The last warning in our list referred to this HTML element:

<aside class="widget-area site-header-item header-widget1 header-widget-lstyle-plain"> 

Kadence had inserted the widget area inside the site header using the aside element.

The scanner had detected the complementary landmark which was nested inside other landmark.

It sounds like a simple problem which could be easily fixed by changing semantics.

But let's dig a little bit deeper into the rule.

Deque has deprecated the landmark-complementary-is-top-level rule in newer axe-core versions. Nested complementary landmarks are not forbidden now according to the modern ARIA guidance.

So, it means that we did not have a real issue on our hands.

In our case, the header widget was not a separate complementary section. We've added role="none" to it using WordPress Code Snippets plugin without changing any Kadence Pro files.

The warning disappeared.

Was the website more accessible after this? No, it was just a semantic fix of this particular element.

The difference between the warning disappearance and the improvement in terms of accessibility appeared once again with Chaty.

Chaty widget and vanishing element ID

Next two warnings were related to the floating contact button.

This element and this part of HTML code:

<div class="chaty-channel-list" id="csaas-channels-_1"> 

and

<span class="on-hover-text">Contact us</span> 

had been detected by the scan as outside recognized landmarks.

Opening Firefox DevTools and looking for this channel-list ID, we found nothing.

The element wasn't there.

After opening the Chaty widget, we found this:

<div class="chaty-channel-list" id="csaas-channels-0"> 

So, this ID has been changed. The first attempt to refer to this specific ID was already too narrow.

We didn't try to catch the element ID anymore. Instead, we checked the parent elements of the visible text "Contact us".

The structure helped us to detect the more reliable container:

span.on-hover-text div.chaty-channel div.chaty-i-trigger div.chaty-channels div.chaty-widget div#chaty-widget-0 body 

It was the outer container of the widget.

This container had been placed directly in body, outside of usual landmarks of the page.

Knowing this structure, the fixing was not difficult anymore.

We had added a region role to the outer container and this way the both contact text and channels list have fallen inside this region.

There were no changes in the look required.

Checking the container for the DevTools

If your scan detects some content as outside of landmarks, you can try this simple check in DevTools:

const el = document.querySelector('.on-hover-text'); el?.closest( 'main, header, footer, nav, aside, [role="region"]' ); 

If the function will return null, this element isn't located inside of any of these landmarks. So, you can look at its ancestry and find a suitable container.

Do not forget that the landmark should represent a meaningful section of the page. Do not create too many region landmarks, it will become hard to navigate for users.

Also, we had checked the modified Chaty widget in a browser session without logging in WordPress. It was important since widgets may behave differently depending on the way the page loads.

We performed another scan, and… no issues detected.

What have we actually improved?

The feeling of victory was nice. Our website became one of four websites with no issues in automated Ukrainian IT-sector accessibility ranking.

However, I wouldn't consider it as full WCAG compliance.

We've fixed 3 issues reported in the scan on one homepage. We didn't perform manual tests for all pages, forms, keyboard paths, screen-readers etc.

And one of the warnings was about the rule which had been already deprecated in other places.

Zero findings in the scan help to see what the tool has actually checked. It is not a guarantee of accessibility of your entire website.

Besides, there's one more practical conclusion about WordPress website maintenance.

Before applying any changes to theme or adding an accessibility plugin, check the actual DOM. Is the scan up-to-date? Check the surrounding HTML, not only the element indicated by the scanner.

Sometimes, the problem is in the theme itself. Sometimes, in the third party plugin. Sometimes, in the outdated scan results.

I prefer spending a few minutes for understanding the markup rather than performing a lot of changes to improve some scores.

Further reading

This debugging session was a part of a wider WordPress accessibility audit. We have checked the limits of WCAG testing and also analyzed the accessibility findings on a sample of Ukrainian IT-sites.

Full article on PBB Design here.