Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WCAG 4.1.2 A: Back to top button has no accessible name (Issue 34) #359

Closed
CJE001 opened this issue Sep 13, 2024 · 4 comments
Closed

WCAG 4.1.2 A: Back to top button has no accessible name (Issue 34) #359

CJE001 opened this issue Sep 13, 2024 · 4 comments
Labels
A11y Issue is related to accessibility Core CivicTheme Core CivicTheme issue State: Done The issue is complete and waiting for a release Type: Defect Issue is a defect

Comments

@CJE001
Copy link

CJE001 commented Sep 13, 2024

Summary

Via Vision Australia assessment: August 2024

Impact: medium

Note: DTA have a 90 day remediation period to address the identified issues within the audit, all issues must be resolved to obtain WCAG 2.2 certification for digital.gov.au

Steps to reproduce

Global issue – Back to top button
digital.gov.au beta | digital.gov.au (https://www.digital.gov.au)

Observed outcome

The back to top button uses an arrow icon to visually communicate its purpose; however, the button has no accessible name.

Picture10

Code used

<div class="ct-back-to-top ct-scrollspy-scrolled" data-component-name="back-to-top" data-scrollspy="true" data-scrollspy-offset="400">
<a class="ct-button ct-theme-light ct-button--primary ct-button--link ct-button--regular ct-back-to-top__button" role="button" data-component-name="button" href="#top" data-button="true">
<svg class="ct-icon ct-button__icon" aria-hidden="true" role="img" width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
…
</svg>
</a>
</div>

Why this matters

When a button lacks an accessible name, screen readers cannot communicate its purpose or functionality to users. As a result, users may have difficulty determining what the button does or how to interact with it.

Users who navigate with speech recognition technologies may encounter difficulties activating interactive elements without an accessible name. They may be forced to use alternative navigation methods, such as the mouse grid, which can be considerably more time consuming.

Expected outcome

Preferably, provide an accessible name for the button via HTML text content. This will be visible for all users and ensure that the button purpose is clear.

Alternatively, provide an accessible name for the button via visually hidden text or the aria-label attribute.

Ideally, adjust the border colour of the element so that it is more visible when the link appears over a darker background (for example, as has been done with the feedback widget). While this is not required for WCAG conformance, it will improve the discoverability of the link.

Code example – text content

<a class="ct-button ct-theme-light ct-button--primary ct-button--link ct-button--regular ct-back-to-top__button" role="button" data-component-name="button" href="#top" data-button="true">
<svg class="ct-icon ct-button__icon" aria-hidden="true" role="img" width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
…
</svg>
Back to top 
</a>

Code example – visually hidden text

<a class="ct-button ct-theme-light ct-button--primary ct-button--link ct-button--regular ct-back-to-top__button" role="button" data-component-name="button" href="#top" data-button="true">
<svg class="ct-icon ct-button__icon" aria-hidden="true" role="img" width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
…
</svg>
<span class="visually-hidden">
Back to top
</span>
</a>
CSS
.visually-hidden:not(:focus):not(:active) {
clip: rect(0 0 0 0);
clip-path: inset(50%);
height: 1px;
overflow: hidden;
position: absolute;
white-space: nowrap;
width: 1px;
}

Code example – aria label

<a class="ct-button ct-theme-light ct-button--primary ct-button--link ct-button--regular ct-back-to-top__button" role="button" data-component-name="button" href="#top" data-button="true" aria-label="back to top">
<svg class="ct-icon ct-button__icon" aria-hidden="true" role="img" width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
…
</svg>
</a>
@CJE001 CJE001 added the Type: Defect Issue is a defect label Sep 13, 2024
@fionamorrison23 fionamorrison23 added the A11y Issue is related to accessibility label Sep 17, 2024
@github-project-automation github-project-automation bot moved this to Todo in UI Kit Sep 17, 2024
@richardgaunt
Copy link
Collaborator

@jcloys https://www.drupal.org/project/civictheme/issues/3466016

Amey provided this patch to address the above issue - could you review the fix and let me know if it resolves the above.

@richardgaunt
Copy link
Collaborator

@sonamchaturvedi28 Fix has been merged and is ready for testing.

@alan-cole alan-cole added the Core CivicTheme Core CivicTheme issue label Oct 14, 2024
@fionamorrison23
Copy link
Collaborator

@CJE001 this issue is pending release. I'm closing this ticket as work was done in https://www.drupal.org/project/civictheme/issues/3466016.

@fionamorrison23 fionamorrison23 added the State: Done The issue is complete and waiting for a release label Oct 17, 2024
@fionamorrison23
Copy link
Collaborator

fionamorrison23 commented Feb 10, 2025

Fixed

@github-project-automation github-project-automation bot moved this from Todo to Done in UI Kit Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A11y Issue is related to accessibility Core CivicTheme Core CivicTheme issue State: Done The issue is complete and waiting for a release Type: Defect Issue is a defect
Projects
Status: Done
Development

No branches or pull requests

6 participants