I just installed the “Complianz Cookie Consent” plugin – so far the best I’ve tested. Unfortunately, I noticed some accessibilty issues in the cookie banner. Since you claim that your plugin complies with WCAG 2.1, I can imagine that you will want to fix them:
The x button to close the cookie banner has no visual focus indicator – also, if possible a <button> element would be better for usability than a <div role="button">.
Focus should be trapped inside the modal window, so that users don’t tab outside of it while it is still visible. That means that after the last interactive element of the window (the ‘settings’ button or the document links), the focus should go back to the close button
In the “Cookie settings” window, the checkboxes #cmplz-statistics-optin and #cmplz-marketing-optin have no accessible name. They do have an explicit <label>, but the <span> inside has display:none which hides it also for screen readers. You need to use an accessible hiding method on the .screen-reader-text class instead of display:none. I would recommend this method: https://www.scottohara.me/blog/2017/04/14/inclusively-hidden.html#hiding-content-visually
The same labels have a tabindex="0", which makes them focusable. When I tab through the window, it creates a “blank” tab after the <input>.
In the same window, the <summary> elements have no visual focus indicator.
Interactive controls must not be nested, so <input type="checkbox"> should not be located inside <summary>. That create issues for screen reader users who might not be able to access the checkbox.
Let me know if you need more details ! I really hope that you will fix these issues in a future release 🙂
This topic was modified 1 year, 6 months ago by Aline K..
The page I need help with: [log in to see the link]
Let’s start with 1: The x button to close the cookie banner also has no visual focus indicator – also, a <button> element whould be better than a <div>.
Thank you for your quick answer ! Yes, that’s exactly what I’m talking about. A <button> element would have a default :focus outline defined by the browser, but this one is made with a <div> so we need to manually add the :focus / :focus-visible state styles.
My bad, it seems that my theme is responsible for that one – really sorry about that, I should have checked better. It looks fine with WP base themes. Same for point 5 about the :focus on the <summary> elements.
The 4 other issues in my initial message are not resolved (and the theme is not responsible for those ones, I checked twice 😅). In particular, points 3 and 6 are detected by automated accessibility testing tools and create non-compliance with WCAG:
In the “Cookie settings” window, the checkboxes #cmplz-statistics-optin and #cmplz-marketing-optin have no accessible name. They do have an explicit <label>, but the <span> inside has display:none which hides it also for screen readers.
Interactive controls must not be nested, so <input type="checkbox"> should not be located inside <summary>. That create issues for screen reader users who might not be able to access the checkbox.
Focus should be trapped inside the modal window, so that users don’t tab outside of it while it is still visible. That means that after the last interactive element of the window (the ‘settings’ button or the document links), the focus should go back to the close button
When the cookie banner behaves as a modal dialog, it would be nice if it followed the WAI pattern: “TAB: If focus is on the last tabbable element inside the dialog, moves focus to the first tabbable element inside the dialog.”
Yes the <label> is there in the HTML, but the <span> inside it has display:none in the CSS, which makes the label inaccessible (screen readers will ignore elements with display:none).
Here is a screenshot of the CSS in the browser dev tools:
This happens with the toggle and the regular checkbox. The .screen-reader-text class on the <span> already hides the text – while still keeping it accessible for screen readers.
regarding; `Focus should be trapped inside the modal window, so that users don’t tab outside of it while it is still visible. That means that after the last interactive element of the window (the ‘settings’ button or the document links), the focus should go back to the close button
When the cookie banner behaves as a modal dialog, it would be nice if it followed the WAI pattern: “TAB: If focus is on the last tabbable element inside the dialog, moves focus to the first tabbable element inside the dialog.”
I’m still unsure if a consent banner has the same urgency as a dialog, or alert modal.
Both the latter seem to interupt an action for confirmation, or extra help, a new step etc and focussing here would be logical.
A consent banner, is informative and the choices can be made later, or on the content blocks that need consent. In the example here; https://soxenomorph-zeyi.instawp.xyz/ there’s a mode where this happens automatically, if soft cookie wall is enabled.
regards Aert
Viewing 10 replies - 1 through 10 (of 10 total)
The topic ‘Accessibility issues’ is closed to new replies.