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

Fix(rgaa): Nav attributes and aria-current for accessibility compliance #1239

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

BarbaraOliveira13
Copy link

@BarbaraOliveira13 BarbaraOliveira13 commented Dec 17, 2024

🎩 What?

Two parts:

  1. Added dynamic aria-label attributes to navigation menus to provide better context for screen readers, improving compliance with WCAG 1.3.1 - Info and Relationships(Level A).
  2. Added aria-current="true" to correctly mark active links within navigation menus, addressing WCAG 2.4.8 - Location (Level AAA).

🎩 Why?

This issue originates from an accessibility audit funded by the city of Lyon, targeting compliance with RGAA and corresponding WCAG standards. The changes ensure clearer navigation and improved usability for assistive technologies.

📌 Related Issues

  • Related to: WCAG 1.3.1, 2.4.8, and RGAA 9.2/10.9.
  • Fixes #?

📋 Subtasks

  • Update tags to include dynamic aria-label attributes, addressing WCAG 1.3.1 - Info and Relationships.
  • Add aria-current="true" to active links in navigation menus to comply with WCAG 2.4.8 - Location.
  • Verify the changes comply with RGAA best practices.
  • Add CHANGELOG entry
  • If there's a new public field, add it to GraphQL API
  • Add documentation regarding the feature
  • Add/modify seeds
  • Add tests
  • Another subtask

📷 Screenshots (optional)

Capture d’écran 2024-12-18 à 17 16 17

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pull request does not contain a valid label. Please add one of the following labels: ['type: feature', 'type: change', 'type: fix', 'type: removal', 'target: developer-experience', 'type: internal']

@BarbaraOliveira13 BarbaraOliveira13 changed the title add role & aria-label to nav menu for accessibility compliance fix(rgaa): add role & aria-label to nav menu for accessibility compliance Dec 17, 2024
@BarbaraOliveira13 BarbaraOliveira13 changed the title fix(rgaa): add role & aria-label to nav menu for accessibility compliance fix(rgaa): fix/ nav-attributes-and-aria-current for accessibility compliance Dec 17, 2024
@BarbaraOliveira13 BarbaraOliveira13 changed the title fix(rgaa): fix/ nav-attributes-and-aria-current for accessibility compliance fix(rgaa): nav-attributes-and-aria-current for accessibility compliance Dec 17, 2024
@BarbaraOliveira13 BarbaraOliveira13 changed the title fix(rgaa): nav-attributes-and-aria-current for accessibility compliance Fix(rgaa): Nav attributes and aria-current for accessibility compliance Dec 17, 2024
Copy link

@Quentinchampenois Quentinchampenois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The aria-label must be translated in locales files, in English only

@@ -10,7 +10,7 @@
</header>

<div class="vertical-tabs">
<nav>
<nav role="navigation" aria-label="Sous menu - <%= translated_attribute(page.title) %>">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<nav role="navigation" aria-label="Sous menu - <%= translated_attribute(page.title) %>">
<nav role="navigation" aria-label="<%= i18n.t(".navigation.aria_label", title: translated_attribute(page.title)) %>">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Translation key could just be aria_label

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, changes made 👍

@BarbaraOliveira13 BarbaraOliveira13 marked this pull request as ready for review December 18, 2024 17:19
@@ -21,7 +21,7 @@
<ul id="dropdown-menu-pages" class="vertical-tabs__list" role="menu">
<% pages.each do |sibling| %>
<li class="<%= "is-active" if page == sibling %>" role="menuitem">
<%= link_to translated_attribute(sibling.title), page_path(sibling.slug) %>
<%= link_to translated_attribute(sibling.title), page_path(sibling.slug), aria_current: ("true"if page == sibling) %>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<%= link_to translated_attribute(sibling.title), page_path(sibling.slug), aria_current: ("true"if page == sibling) %>
<%= link_to translated_attribute(sibling.title), page_path(sibling.slug), aria_current: (page == sibling).to_s %>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Condition in itself returns a TrueClass or FalseClass, you can use the condition return as string directly

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, thanks!

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

Successfully merging this pull request may close these issues.

2 participants