Skip to content

Make Front of House Icons and Tables Accessible #4215#4492

Merged
mauromsl merged 14 commits into
masterfrom
b-4215_front_of_house_icon_ally
Mar 11, 2025
Merged

Make Front of House Icons and Tables Accessible #4215#4492
mauromsl merged 14 commits into
masterfrom
b-4215_front_of_house_icon_ally

Conversation

@StephDriver

@StephDriver StephDriver commented Nov 18, 2024

Copy link
Copy Markdown
Member

closes #4215
closes #4055

@StephDriver

This comment was marked as resolved.

@StephDriver StephDriver force-pushed the b-4215_front_of_house_icon_ally branch from 4654fd2 to ad0f7a1 Compare November 25, 2024 11:31
@StephDriver StephDriver changed the title icons identified #4215 Make Front of House Icons Accessible #4215 Nov 25, 2024
@StephDriver

This comment was marked as outdated.

@StephDriver

This comment was marked as resolved.

@StephDriver

StephDriver commented Nov 28, 2024

Copy link
Copy Markdown
Member Author

I categorised icons according to the below by inserting a comment above each icon - which I then removed before finalising the PR, so those comments can be found in the commit history to track the 'why' of each change.

Icon Categories

We use both decorative and semantic icons in the Front of House. In every case, icons are inserted using the syntax: <i aria-hidden="true" class="fa fa-icon-name"></i>. Where these are decorative, that is all that is required. Where the icon is being used to indicate a date, then the date which follows should be able to be programatically determined by using the <time> tag. The final category are semantic icons, where a non-visual alternative is required, and this is coded using the <span class="sr-only">text alternative </span> syntax.

Icons should not be included in any other way unless no fa version exists.
known exceptions:

  • ORCID logo (inserted as image).
  • X logo (a hidden span with unicode).
  • unicode × (&times;) used for close buttons

Decorative

these icons are purely decorative, and should include aria-hidden="true"

<i aria-hidden="true" class="fa fa-search"></i>

Semantic

these icons should be aria-hidden=true as with decorative, but have adjacent <span class="sr-only"> text alternative</span>. Note, the sr-only span may be a few lines before or after the icon, depending only on where it make the most sense if read aloud in the context of other content.

<span class="sr-only">{% trans 'Externally hosted article:' %} </span>
{{ article.title|safe }}&nbsp;
<i aria-hidden="true" class="fa fa-external-link small-icon-text"></i>

or

<i aria-hidden="true" class="fa fa-play" ></i>
<span class="sr-only">{% trans 'Play' %}</span>

Special Cases

Date

These icons are used to indicate a date, and should be marked as decorative with the date itself marked up with the <time> html tag. Note that the <time> tag is not yet supported by WAI-ARIA but is recommended for future proofing. Screen reader support is variable, and from manual testing, the internal <span role="time"> was found to be needed to prevent some screen-readers from reading out the date twice. This is therefore the format to be used:

<i aria-hidden="true" class="fa fa-calendar"></i>
<time datetime="{{ article.date_published|date:"Y-m-d" }}">
    <span role="time">{{ article.date_published|date:"Y-m-d" }}</span>
</time>

Email (within a loop)

These icons are semantic, however as many of our email icons are as part of 'email author' links where a loop is used because there could be more than one author. In order to meet WCAG 2.4.4 these sr-only spans need to include the author name so as not to create multiple indistinguishable 'email author' links. A similar approach should be taken for any other semantic icons used with logic loops which could output multiple copies.

<a itemprop="email" href="mailto:{{ author.email }}" >
    <i aria-hidden="true" class="fa fa-envelope email-link" ></i>
    <span class="sr-only">{% trans 'Email' %} {{ author.full_name }}.</span>
</a>

ORCID logo as a link to an author's ORCID profile

Handle as Semantic Icons. These are not strictly icons, as it is included as a local .png. However, as with author emails, it is important to make the text alternative for these links unique, by including the author's name. Note, when testing with VoiceOver, using an aria-label on the <a> tag did not work well, as it ended up with the ORCID numbers being included in the link description that was read aloud.

<a href="https://orcid.org/{{ author.orcid }}" class="">
    <img src="{% static 'common/img/icons/orcid.png' %}" alt="">
    <span class="sr-only">{{author.full_name}} {% trans 'ORCID profile.' %}</span>
</a>

X

Our icon set doesn't include the X logo. But the unicode 𝕏 (&#120143;) looks identical, so we have used that. Note the span that includes the X needs to be aria-hidden=true .

<span aria-hidden="true"> &#120143;</span>
<span class="sr-only">{% trans 'Share on X' %}</span>

× for close

We have used the unicode &times; on close buttons in many places. This is already accessibly marked up, so has been not been changed during this update.

<button class="close-button" data-close aria-label="Close modal" type="button">
    <span aria-hidden="true">&times;</span>
</button>

@StephDriver StephDriver force-pushed the b-4215_front_of_house_icon_ally branch 3 times, most recently from a185ae6 to daa4ae1 Compare December 2, 2024 10:35
@StephDriver

This comment was marked as resolved.

@StephDriver

This comment was marked as resolved.

@StephDriver StephDriver force-pushed the b-4215_front_of_house_icon_ally branch 2 times, most recently from 729d8d3 to f7772d2 Compare December 16, 2024 14:44
@StephDriver

This comment was marked as resolved.

@StephDriver

This comment was marked as resolved.

@StephDriver StephDriver force-pushed the b-4215_front_of_house_icon_ally branch from 092624c to f3e8e13 Compare December 19, 2024 09:58
@StephDriver

Copy link
Copy Markdown
Member Author

Testing

Results

Theme Template Tested
Clean core/homepage_elements/search_bar.html
Clean core/news/item.html
Clean elements/article_listing.html
Clean elements/journal/editorial_social_content.html
Clean elements/journal/issue_sidebar.html
Clean elements/preprint_block.html passed on sight
Clean elements/public_reviews.html passed on sight
Clean elements/sections_block.html
Clean journal/article.html
Clean journal/homepage_elements/carousel.html
Clean journal/print.html no styling on page, remove this.
Clean press/core/news/item.html passed on sight
Clean press/nav.html
Material core/homepage_elements/search_bar.html
Material core/nav.html
Material core/news/item.html
Material elements/article_listing.html
Material elements/journal/issue_list.html
Material elements/journal/issue_sidebar.html
Material elements/license_block.html
Material elements/nav_element.html not used
Material elements/pagination.html
Material elements/preprint_block.html passed on sight
Material elements/public_reviews.html passed on sight
Material elements/sections_display.html
Material journal/article.html
Material preprints/article.html not used
Material preprints/editors.html passed on sight
Material preprints/list.html deprecated
Material press/core/news/item.html passed on sight
Material press/nav.html
Material repository/home.html
Material repository/list.html
Material repository/nav.html
Material repository/preprint.html
OLH core/base.html
OLH core/homepage_elements/search_bar.html
OLH core/nav.html
OLH core/news/item.html
OLH elements/journal/box_article.html
OLH elements/journal/editorial_social_content.html
OLH elements/journal/issue_sidebar.html
OLH elements/journal/preprint_article_listing.html not used
OLH elements/public_reviews.html passed on sight
OLH elements/section_block.html
OLH elements/submit/author.html not used
OLH journal/article.html
OLH journal/print.html no styling on page, remove this.
OLH press/core/news/item.html passed on sight
OLH repository/elements/preprint_home_listing.html
OLH repository/home.html
OLH repository/list.html
OLH repository/preprint.html

Notes

  • "passed on sight" are items where code was reviewed by @ajrbyers
  • ✅ passed a manual review of the page
  • "not used" / "deprecated" are templates no longer in use
  • "no styling on page" refers to two templates were icons shouldn't be used anyway, these were then removed.

@StephDriver StephDriver force-pushed the b-4215_front_of_house_icon_ally branch from 7c1715d to d2ada22 Compare December 19, 2024 15:33
@StephDriver StephDriver changed the title Make Front of House Icons Accessible #4215 Make Front of House Icons and Tables Accessible #4215 Dec 19, 2024
@StephDriver StephDriver requested a review from mauromsl December 19, 2024 15:34
@StephDriver StephDriver marked this pull request as ready for review December 19, 2024 15:35
@ajrbyers ajrbyers assigned StephDriver and unassigned mauromsl Feb 11, 2025
@ajrbyers

Copy link
Copy Markdown
Member

I've re-assigned this issue to @StephDriver as there is an outstanding conflict.

@StephDriver StephDriver force-pushed the b-4215_front_of_house_icon_ally branch from d2ada22 to 1e2862b Compare February 14, 2025 09:00
@StephDriver

Copy link
Copy Markdown
Member Author

I've re-assigned this issue to @StephDriver as there is an outstanding conflict.

resolved.

@StephDriver StephDriver force-pushed the b-4215_front_of_house_icon_ally branch from 1e2862b to fccfc36 Compare March 3, 2025 12:41
@StephDriver

StephDriver commented Mar 3, 2025

Copy link
Copy Markdown
Member Author

conflicts resolved. I have also reviewed the new share templates that replace several icons used here, and they match the new syntax.

@joemull joemull left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Amazing work!

I caught one typo with missing end </span>.

I also wanted to request that we go ahead and use accessible form label elements for the search inputs that have until now been "labelled" by means of search icons. Please see comments inline about that. Is that acceptable in this PR or do you prefer to handle it separately along with accessible names for other form inputs?

<span class="input-group-label"><i class="fa fa-search"></i></span>
<span class="input-group-label"><i aria-hidden="true" class="fa fa-search"></i></span>
<input class="input-group-field" type="search" name="article_search" placeholder="{% trans 'Search' %}">
<input type="hidden" name="sort" value="title">

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This search input is still missing an accessible name. The placeholder is not enough because it goes away once the user types something. Can we add an sr-only label with a value of "Search" and tie it to the input?

<span class="input-group-label"><i aria-hidden="true" class="fa fa-search"></i></span>
<label class="sr-only" for="article_search">{% trans "Search" %}</label>
<input class="input-group-field" type="search" name="article_search" id="article_search" placeholder="{% trans 'Search' %}">

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

this is no more inaccessible than before, this change was just about icons.

<i aria-hidden="true" class="fa fa-search"></i>
<span class="sr-only">{% trans 'Search' %}</span>
</span>
<input name="article_search" class="input-group-field" type="text">

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Similar to with the OLH theme template for search, this needs a more robust label explicitly tied to the input. In this case I think the <span class="sr-only"> should be changed to a label and tied to the input with a "for" attribute.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

great, but not in this PR.

<i aria-hidden=true class="fa fa-search"></i>
</span>
<input class="input-group-field" type="search" name="search_term"
placeholder="Search {{ request.repository.object_name_plural }}...">

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This needs an accessible label like the other two search bars above.

In this case a label with sr-only and a for linked to the search input should do the trick.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yes, but not in this PR.

</span>
<input class="input-group-field" type="search" name="search_term"
placeholder="{% trans "Search preprints" %}"
{% if search_term %}value="{{ search_term }}"{% endif %}>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As above, use label instead of span for the sr-only line, and connect it to the search input with for

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yes, but not here.

Comment thread src/themes/material/templates/elements/journal/issue_list.html
@joemull joemull assigned StephDriver and unassigned mauromsl and joemull Mar 4, 2025
@StephDriver

StephDriver commented Mar 6, 2025

Copy link
Copy Markdown
Member Author

@joemull I think adding in Search labels is feature creep over this PR which was very specifically for icons and tables (the two were originally separate, but the table one hadn't gone through and they handle the same lines, so they were bundled for practicality, the search changes haven't even been started yet, so not the same).

the accessible search is needed, but that's out of scope here - and needs to be done across all templates just like these changes were done across all to get them standardised. The search is no less accessible than it was before.

@StephDriver StephDriver requested a review from joemull March 6, 2025 08:59
@StephDriver StephDriver assigned mauromsl and joemull and unassigned StephDriver Mar 6, 2025
@mauromsl mauromsl merged commit 96b59c3 into master Mar 11, 2025
@mauromsl mauromsl deleted the b-4215_front_of_house_icon_ally branch March 11, 2025 12:28
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.

Icon A11y improvements Table A11y updates

4 participants