Skip to content

a11y: update credit link markup for screen-readers#5106

Merged
joemull merged 4 commits intomasterfrom
b-5105-olh-article-icon-aria
Feb 16, 2026
Merged

a11y: update credit link markup for screen-readers#5106
joemull merged 4 commits intomasterfrom
b-5105-olh-article-icon-aria

Conversation

@StephDriver
Copy link
Member

@StephDriver StephDriver commented Jan 23, 2026

single instance of non-compliance with WCAG 1.3.3 (#5105) for the OLH theme.

the audit for this SC identified that the icon had no text-equivalent. Then while fixing, I also found the external link wasn't marked up so added that fix which would otherwise have been found on a later audit when looking at navigation.

While fixing this, I also found that CrediT wasn't displaying on the OLH article page at all, due to a logic error. I have fixed that in the second commit here.

@StephDriver StephDriver self-assigned this Jan 23, 2026
@StephDriver StephDriver requested a review from ajrbyers January 23, 2026 12:00
@StephDriver StephDriver assigned ajrbyers and unassigned StephDriver Jan 23, 2026
@ajrbyers ajrbyers requested a review from joemull February 5, 2026 09:52
@ajrbyers ajrbyers assigned joemull and unassigned ajrbyers Feb 5, 2026
Copy link
Member

@joemull joemull left a comment

Choose a reason for hiding this comment

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

Thanks for catching these things.

I've got a couple of suggestions for how to simplify it, and there's also a bug in the double for-loop.

{{ record }}{% if not forloop.last %}, {% endif %}
{% if journal_settings.general.use_credit %}
{% for author_check in article.frozen_authors.all %}
{% if author_check.credits.exists %}
Copy link
Member

Choose a reason for hiding this comment

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

This creates two levels of for-loops, causing the section to display multiple times, once for each author:

Image

I'd probably fix it instead by creating a new context variable called credit_records_exist in the view, which queries credit records for a any relationship to the article, like this:

credit_records_exist = models.CreditRecord.objects.filter(frozen_author__article=article).exists()

Then use that instead of the broken piece of logic:

{% if journal_settings.general.use_credit and credit_records_exist %}

Copy link
Member Author

@StephDriver StephDriver Feb 13, 2026

Choose a reason for hiding this comment

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

Logic updated as suggested.

<a href="https://www.niso.org/publications/z39104-2022-credit" target="_blank">
<span class="sr-only">{% trans "Read more about Credit." %} </span>
<i aria-hidden="true" class="fa fa-info"></i>
{% include "elements/icons/link_external.html" %}
Copy link
Member

Choose a reason for hiding this comment

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

This feels a bit too icon-y, and the two icons right next to each other are visually distracting, since they are not positioned the same way (I understand why, but nevertheless).

Maybe we can just get rid of the i and replace it with the phrase "read more", with the whole link in parentheses? This would make the external link icon work better.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'd much prefer that!

Copy link
Member Author

Choose a reason for hiding this comment

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

And Read more link. It looked intrusive under the heading, so I put it at the end intead.

image

@joemull joemull assigned StephDriver and unassigned joemull Feb 12, 2026
@StephDriver
Copy link
Member Author

Note to self - update is now working on OLH, but credit no longer displaying on Clean or Material, can't find it on Master either, need more investigation as to what is going wrong. As I only started that bugfix because it was working on C & M and not on O.

@joemull joemull merged commit 04b1c28 into master Feb 16, 2026
1 check failed
@joemull joemull deleted the b-5105-olh-article-icon-aria branch February 16, 2026 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants