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

feat(VerticalNavigation): improve accessibility #948

Merged
merged 2 commits into from
Dec 26, 2023
Merged

feat(VerticalNavigation): improve accessibility #948

merged 2 commits into from
Dec 26, 2023

Conversation

neilmispelaar
Copy link
Contributor

@neilmispelaar neilmispelaar commented Nov 11, 2023

πŸ”— Linked issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

This PR will enhance the accessibility (#a11y) of the VerticalNavigation component by adding the following:

  • Structural list markup (ul li) for each vertical navigation element
  • Adds visually hidden text (but accessible to screen readers and assistive technologies) that identifies the current page that the user is on

Problem we are solving

The VerticalNavigation element in its current state fails the following WCAG success criteria:

Use of Color

When the VerticalNavigation component determines that a page is "active" (i.e. the current page) it applies styles to the link to signify that the current page is active. This is shown below:

Screenshot 2023-11-11 at 10 02 39β€―AM

This is great UX. However, if you are using a screenreader or assistive technology, you don't "see" these styles and so you miss out on this important information.

Adding hidden text that tells the user they are on the "Current page" addresses this deficiency.

https://www.w3.org/WAI/tutorials/menus/structure/#indicate-the-current-item

Info and Relationships

Visually, and structurally, I would submit that the VerticalNavigation component creates a list of links. However, the markup does not demonstrate this structure, as the links are just added to the markup sequentially.

By adding HTML list markup ul and li this addresses SC 1.3.1 and enhances the accessibility of the markup.

https://www.w3.org/WAI/tutorials/menus/structure/#unordered-list

Potential concern

To identify the current page, I added in a visually hidden text "Current Page:" before the link label. The text is English.

Developers creating websites or web applications that are in a different language would then have English text within their projects. At least the text would be hidden visually, but wouldn't make too much sense in other languages.

Perhaps a future enhancement would be to either have the text user definable, or have some sort of prop mechanism that specifies the languages and then the string is pulled from a lookup table.

Screenshot

Screenshot 2023-11-11 at 10 13 16β€―AM

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

Copy link

vercel bot commented Nov 11, 2023

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

Name Status Preview Updated (UTC)
ui βœ… Ready (Inspect) Visit Preview Dec 26, 2023 11:50am

@benjamincanac benjamincanac changed the title chore(VerticalNavigation): improve accessibility fix(VerticalNavigation): improve accessibility Dec 26, 2023
@benjamincanac benjamincanac changed the title fix(VerticalNavigation): improve accessibility feat(VerticalNavigation): improve accessibility Dec 26, 2023
@benjamincanac benjamincanac merged commit 29e64ca into nuxt:dev Dec 26, 2023
2 checks passed
@benjamincanac
Copy link
Member

Thanks 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants