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
6 changes: 3 additions & 3 deletions decidim-core/app/views/decidim/pages/_tabbed.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
</header>

<div class="vertical-tabs">
<nav>
<button id="dropdown-trigger-pages" data-component="dropdown" data-target="dropdown-menu-pages" data-open-md="true" data-auto-close="true">
<nav role="navigation" aria-label="<%= I18n.t("layouts.decidim.navigation.aria_label", title: translated_attribute(page.title)) %>">
<button id="dropdown-trigger-pages" data-component="dropdown" data-target="dropdown-menu-pages" data-open-md="true" data-auto-close="true">
<span>
<%= translated_attribute(page.title) %>
</span>
Expand All @@ -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!

</li>
<% end %>
</ul>
Expand Down
2 changes: 2 additions & 0 deletions decidim-core/config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2123,6 +2123,8 @@ en:
expire_time_html: Your session will expire in <b><span class="minutes">%{minutes}</span> minutes</b>.
language_chooser:
choose_language: Choose language
navigation:
aria_label: Navigation menu - %{title}
notifications_dashboard:
mark_all_as_read: Mark all as read
mark_as_read: Mark as read
Expand Down
Loading