Skip to content

Commit 9d62a44

Browse files
Make TR listing easier to visually scan
- Remove number from contextual text, as it seems of minimal benefit to people - Visually hide contextual text in TR translations <dt>, leaving it available for screen reader users - Add CSS to compensate for blank inline space created by visuallyhidden text
1 parent 7465baa commit 9d62a44

File tree

6 files changed

+12
-4
lines changed

6 files changed

+12
-4
lines changed

assets-src/styles/sass/80-templates/_technical-reports.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131
background-color: $white;
3232
}
3333

34+
// Close visual gap between end of visible text and CSS-inserted colon caused by visuallyhidden <span>
35+
// Only works while there is a single visuallyhidden <span> as the last child in the <dt>
36+
.translation-list dt:has(span.visuallyhidden)::after {
37+
margin-inline-start: rem(-4);
38+
}
3439
}
3540

3641
.tr-list {

design-system-templates/components/tr-search-results-family.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
<dd>Michael Cooper</dd>
5656
</div>
5757
<div class="translation-list">
58-
<dt>2 translations for Accessible Rich Internet Applications (WAI-ARIA) 1.0</dt>
58+
<dt>Translations <span class="visuallyhidden">/span> Accessible Rich Internet Applications (WAI-ARIA) 1.0</span></dt>
5959
<dd><a hreflang="ja" href="path/to/page"><span lang="ja">日本語</span></a></dd>
6060
<dd><a hreflang="hu-HU" href="path/to/page"><span lang="hu-HU">Magyar</span></a></dd>
6161
</div>

design-system-templates/components/tr-search-results-item-standard.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<dd>Michael Cooper</dd>
1919
</div>
2020
<div class="translation-list">
21-
<dt>2 translations for Accessible Rich Internet Applications (WAI-ARIA) 1.0</dt>
21+
<dt>Translations <span class="visuallyhidden">for Accessible Rich Internet Applications (WAI-ARIA) 1.0</span></dt>
2222
<dd><a hreflang="ja" href="path/to/page"><span lang="ja">日本語</span></a></dd>
2323
<dd><a hreflang="hu-HU" href="path/to/page"><span lang="hu-HU">Magyar</span></a></dd>
2424
</div>

public/dist/assets/styles/core.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4933,6 +4933,9 @@ input[type=search] {
49334933
.technical-reports .radio-item label::before {
49344934
background-color: #fff;
49354935
}
4936+
.technical-reports .translation-list dt:has(span.visuallyhidden, span.skip-link)::after {
4937+
margin-inline-start: -0.25rem;
4938+
}
49364939

49374940
.tr-list .tr-list__item {
49384941
display: flex;

public/dist/assets/styles/core.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

templates/components/listings/publications/tr_card.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
{% block translations %}
3131
{% if spec.translations and spec.translations.translations|length > 0 %}
3232
<div class="translation-list">
33-
<dt>{{ spec.translations.translations|length }} translation{% if spec.translations.translations|length > 1 %}s{% endif %} for {{ spec.title }}</dt>
33+
<dt>Translation{% if spec.translations.translations|length > 1 %}s{% endif %} <span class="visuallyhidden">for {{ spec.title }}</span></dt>
3434
{% for t in spec.translations.translations|sort((a,b) => a.language <=> b.language) -%}
3535
<dd><a hreflang="{{ t.language|locale_to_bcp47 }}" href="{{ t.uri }}"><span lang="{{ t.language|locale_to_bcp47 }}">{{ t.language|locale_name(t.language) }}</span></a></dd>
3636
{% endfor -%}

0 commit comments

Comments
 (0)