Skip to content

Commit

Permalink
Hide links around card images from assistive technologies
Browse files Browse the repository at this point in the history
  • Loading branch information
ahosgood committed Sep 5, 2024
1 parent 5766c69 commit 62a7fa3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- Added missing underline to focused buttons using on the `<button>` element
- Links around card images have been hidden from assistive technologies

### Security

Expand Down
2 changes: 1 addition & 1 deletion src/nationalarchives/components/card/fixtures.json
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
"href": "#",
"body": "<p>Card body</p>"
},
"html": "<article class=\"tna-card\"><h3 class=\"tna-heading-m tna-card__heading\"><a href=\"#\" class=\"tna-card__heading-link\">Card title</a></h3><a href=\"#\" class=\"tna-card__image-container\" tabindex=\"-1\"><picture class=\"tna-card__image\"><img src=\"https://loremflickr.com/640/360\" alt=\"A placeholder image\" width=\"640\" height=\"360\"></picture></a><div class=\"tna-card__body\"><p>Card body</p></div></article>"
"html": "<article class=\"tna-card\"><h3 class=\"tna-heading-m tna-card__heading\"><a href=\"#\" class=\"tna-card__heading-link\">Card title</a></h3><a href=\"#\" class=\"tna-card__image-container\" tabindex=\"-1\" aria-hidden=\"true\"><picture class=\"tna-card__image\"><img src=\"https://loremflickr.com/640/360\" alt=\"A placeholder image\" width=\"640\" height=\"360\"></picture></a><div class=\"tna-card__body\"><p>Card body</p></div></article>"
},
{
"name": "with actions",
Expand Down
2 changes: 1 addition & 1 deletion src/nationalarchives/components/card/template.njk
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
{%- endif %}
{%- if params.imageSrc %}
{%- if params.href and (not params.fullAreaClick or params.actions) %}
<a href="{{ params.href }}" class="tna-card__image-container{% if params.hrefClasses %} {{ params.hrefClasses }}{% endif %}" tabindex="-1" {%- for attribute, value in params.hrefAttributes %} {{ attribute }}{% if value !== '' %}="{{ value }}"{% endif %}{% endfor %}>
<a href="{{ params.href }}" class="tna-card__image-container{% if params.hrefClasses %} {{ params.hrefClasses }}{% endif %}" tabindex="-1" aria-hidden="true" {%- for attribute, value in params.hrefAttributes %} {{ attribute }}{% if value !== '' %}="{{ value }}"{% endif %}{% endfor %}>
{%- else %}
<div class="tna-card__image-container">
{%- endif %}
Expand Down

0 comments on commit 62a7fa3

Please sign in to comment.