Skip to content

Commit

Permalink
Re-order card markup for better accessibility
Browse files Browse the repository at this point in the history
I tried the page with NVDA, and the aria-label approach didn't work (apparently it's not valid for 'li' tags). So instead, I just tweaked the markup to properly present the item's title first.
  • Loading branch information
17cupsofcoffee committed Jan 15, 2025
1 parent d590340 commit 709bf3e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
5 changes: 5 additions & 0 deletions sass/_extra.scss
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@
height: 256px;
}

.ui.cards > .card > .content > .header:not(.ui), .ui.card > .content > .header:not(.ui) {
display: inline-block;
margin-bottom: 0;
}

.ui.card > .image > img, .ui.cards > .card > .image > img {
object-fit: cover;
width: 100%;
Expand Down
18 changes: 9 additions & 9 deletions templates/categories/macros.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
{% endif %}
{% endif %}

<li class="ui card{% if archived %} archived{% endif %}" aria-label="{{ name }}">
<li class="ui card{% if archived %} archived{% endif %}">
{% if item.image %}
{% if primary_url %}
<a class="image" href="{{ primary_url }}">
Expand All @@ -98,6 +98,14 @@
{% endif %}

<div class="content">
<h3 class="header">
{% if primary_url %}
<a href="{{ primary_url }}">{{ name }}</a>
{% else %}
{{ name }}
{% endif %}
</h3>

<a class="right floated" href="#{{ name | slugify }}" id="{{ name | slugify }}" aria-label="Permanent link for {{ name }}">
<i class="hashtag icon" aria-hidden="true"></i>
</a>
Expand All @@ -120,14 +128,6 @@
</a>
{% endif %}

<div class="header">
{% if primary_url %}
<a href="{{ primary_url }}">{{ name }}</a>
{% else %}
{{ name }}
{% endif %}
</div>

<div class="meta">
{% for category in item.categories %}
{% set category_data = get_page(path="." ~ section.path ~ category ~ ".md") %}
Expand Down

0 comments on commit 709bf3e

Please sign in to comment.