-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide screen reader alternative to star rating: just the numeric level
- Loading branch information
Showing
1 changed file
with
4 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
{% set wholeStars = level|number_of_whole_stars %} | ||
{% set halfStar = level|half_star %} | ||
{% set remainingStars = 3 - wholeStars %} | ||
<span class="loa-star-rating"> | ||
<span class="loa-star-rating" aria-label="{{ level }}"> | ||
{% if wholeStars > 0 %} | ||
{% for star in 1..wholeStars %} | ||
<img class="star" src="{{ asset('build/images/star.svg') }}"> | ||
<img class="star" src="{{ asset('build/images/star.svg') }}" alt=""> | ||
{% endfor %} | ||
{% endif %} | ||
|
||
{% if halfStar %} | ||
<img class="star star-half" src="{{ asset('build/images/star-half.svg') }}"> | ||
<img class="star star-half" src="{{ asset('build/images/star-half.svg') }}" alt=""> | ||
{% set remainingStars = remainingStars - 1 %} | ||
{% endif %} | ||
|
||
{% if remainingStars > 0 %} | ||
{% for star in 1..remainingStars %} | ||
<img class="star star-open" src="{{ asset('build/images/star-open.svg') }}"> | ||
<img class="star star-open" src="{{ asset('build/images/star-open.svg') }}" alt=""> | ||
{% endfor %} | ||
{% endif %} | ||
</span> |