Skip to content

Commit

Permalink
Various a11y fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
liamjohnston committed Sep 9, 2024
1 parent dc9f6cb commit c5c8b55
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ const DesktopMenuItem = ({
className={cx('main-nav-desktop__item', {
'main-nav-desktop__item--current-section': item.is_current,
})}
aria-current={item.is_current ? 'page' : undefined}
>
<span>{item.title}</span>
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ const MobileMenuItem = ({
/>
</button>
) : (
<a href={item.link_url} className="mobile-menu__nav-btn">
<a
href={item.link_url}
className="mobile-menu__nav-btn"
aria-current={item.is_current ? 'page' : undefined}
>
<span>{item.title}</span>
<Svg
sprite="two-tone"
Expand Down
2 changes: 1 addition & 1 deletion cdhweb/static_src/global/components/main-nav-desktop.scss
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
}

.main-nav-desktop__item--current-section {
border-color: var(--color-brand-40);
border-color: var(--color-brand-100);
}

.main-nav-desktop__dropdown-icon {
Expand Down
2 changes: 1 addition & 1 deletion cdhweb/static_src/global/mixins/three-dee-box.scss
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
}

& > * {
// Make content appear in front of 3d box's solid background
isolation: isolate;
z-index: 1;
}
}
7 changes: 5 additions & 2 deletions templates/includes/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,11 @@
class="main-nav-desktop__item
{% if request.path|starts_with:item.link_url %}
main-nav-desktop__item--current-section
{% endif %}
">
{% endif %}"
{% if request.path|starts_with:item.link_url and not item.l2_items.all %}
aria-current="page"
{% endif %}
>
<span>{{ item.title }}</span>
{# Reserve space for dropdown icon, to stop jank when the React version replaces this version. #}
{% if item.l2_items.all %}
Expand Down
3 changes: 2 additions & 1 deletion templates/includes/pagination.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
{% for number in page_obj.paginator.page_range %}
<a href="?{% url_replace 'page' number %}"
class="pagination__item {% if number == page_obj.number %}pagination__item--current{% endif %}"
>
{% if number == page_obj.number %}aria-current="page"{% endif %}
>
{{ number }}
</a>
{% endfor %}
Expand Down

0 comments on commit c5c8b55

Please sign in to comment.