Skip to content

Commit 36c1aee

Browse files
committed
minor #1139 [Site] Quick wins to improve website accessibility (smnandre)
This PR was squashed before being merged into the 2.x branch. Discussion ---------- [Site] Quick wins to improve website accessibility | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | License | MIT Minor PR to improve the website accessibility via some "quick-wins" * add missing aria labels * use pre/code instead of input in package "install command" Commits ------- 5b74a7a [Site] Quick wins to improve website accessibility
2 parents 0ee0b79 + 5b74a7a commit 36c1aee

File tree

11 files changed

+36
-14
lines changed

11 files changed

+36
-14
lines changed

ux.symfony.com/assets/styles/app/_typography.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ h2.ubuntu {
2424
h3, a.component-title {
2525
font-family: var(--font-family-title);
2626
font-weight: 700;
27-
font-size: 28px !important;
28-
line-height: 32px !important;
27+
font-size: 28px;
28+
line-height: 32px;
2929
letter-spacing: -1px;
3030
color: #0A0A0A;
3131
text-decoration: none;

ux.symfony.com/assets/styles/components/_PackageBox.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,14 @@
112112
flex-direction: row;
113113
align-items: center;
114114
gap: .75rem;
115+
116+
font-family: var(--font-family-title);
117+
font-weight: 700;
118+
font-size: 28px !important;
119+
line-height: 32px !important;
120+
letter-spacing: -1px;
121+
color: #0A0A0A;
122+
text-decoration: none;
115123
}
116124

117125
.PackageBox_link {

ux.symfony.com/assets/styles/components/_TerminalCommand.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
z-index: 1;
1515
max-inline-size: 100%;
1616
max-width: 100%;
17+
width: fit-content;
18+
align-items: center;
19+
align-self: center;
1720

1821
&::before {
1922
content: '';
@@ -39,6 +42,7 @@
3942
padding: 0 .5rem;
4043
width: inherit;
4144
overflow: scroll;
45+
margin: 0;
4246
}
4347

4448
.TerminalCommand_action {

ux.symfony.com/src/Twig/PackageBox.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@
99
class PackageBox
1010
{
1111
public UxPackage $package;
12+
13+
public string $titleTag = 'h3';
1214
}

ux.symfony.com/templates/_footer.html.twig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44
<div class="col-12 col-xl-3 order-xl-3 text-center text-xl-end">
55
<a href="https://github.com/symfony/ux" rel="external noopener noreferrer"
66
style="font-size: 1.5rem;"
7+
aria-label="Symfony UX on GitHub"
78
>
89
<twig:Icon name="github"/>
910
</a>
1011
<a href="https://symfony.com" rel="external noopener noreferrer"
1112
style="font-size: 1.5rem;"
13+
aria-label="Symfony website"
1214
>
1315
<twig:Icon name="symfony"/>
1416
</a>

ux.symfony.com/templates/_header.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<header class="AppHeader {{ theme is defined ? ('AppHeader--' ~ theme) }}">
22
<nav class="navbar navbar-expand-sm AppNav--white">
33
<div class="container-xxl px-4 px-md-5">
4-
<a href="{{ path('app_homepage') }}" class="AppHeader_logo">
4+
<a href="{{ path('app_homepage') }}" class="AppHeader_logo" aria-label="Homepage">
55
<span aria-hidden="false">Symfony UX</span>
66
</a>
77
<button class="AppHeader_toggler navbar-toggler collapsed" type="button"

ux.symfony.com/templates/_nav.html.twig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@
3838
<a class="AppNav_item AppNav_item--icon"
3939
href="https://github.com/symfony/ux"
4040
rel="external noopener noreferrer"
41+
aria-label="Symfony UX on GitHub"
4142
>
4243
<twig:Icon name="github"/>
4344
</a>
44-
<twig:ThemeSwitcher class="AppNav_item AppNav_item--icon" />
45+
<twig:ThemeSwitcher class="AppNav_item AppNav_item--icon" aria-label="Switch dark/light mode" />
4546
{% endblock %}

ux.symfony.com/templates/components/PackageBox.html.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
</div>
77

88
<div class="PackageBox_content">
9-
<h3 class="PackageBox_title">
9+
<{{ titleTag }} class="PackageBox_title">
1010
<a href="{{ path(package.route) }}" class="PackageBox_link">{{ package.humanName }}</a>
1111
<span class="PackageBox_arrow">
1212
<twig:Icon name="arrow-right" />
1313
</span>
14-
</h3>
14+
</{{ titleTag }}>
1515
<div class="PackageBox_description">
1616
{{ package.description|markdown_to_html }}
1717
</div>
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
<div {{ attributes.defaults({class: 'TerminalCommand'}).defaults(stimulus_controller('clipboard')) }}>
2-
<input
2+
<pre
33
class="TerminalCommand_input"
44
aria-label="{{ label|default }}"
5-
size="{{ command|length }}"
6-
value="{{ command }}"
7-
{{ stimulus_target('clipboard', 'source') }}
8-
readonly
5+
><code {{ stimulus_target('clipboard', 'source') }}>{{ command }}</code></pre>
6+
<button
7+
type="button"
8+
class="TerminalCommand_action btn btn-copy"
9+
aria-label="Copy command"
10+
{{ stimulus_action('clipboard', 'copy') }}
911
>
10-
<button type="button" class="TerminalCommand_action btn btn-copy" {{ stimulus_action('clipboard', 'copy') }}>
1112
<twig:Icon name="copy"/>
1213
</button>
1314
</div>

ux.symfony.com/templates/main/homepage.html.twig

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,11 @@
102102
</a>
103103
</div>
104104
<div class="row mt-3 mt-md-5">
105-
{{ block('list', 'main/packages.html.twig') }}
105+
<div style="display: grid; gap: 3rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));">
106+
{% for package in packages %}
107+
<twig:PackageBox :package="package" titleTag="h3" />
108+
{% endfor %}
109+
</div>
106110
</div>
107111
</div>
108112
{% endblock %}

ux.symfony.com/templates/main/packages.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
{% block list %}
1515
<div style="display: grid; gap: 3rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));">
1616
{% for package in packages %}
17-
<twig:PackageBox :package="package"/>
17+
<twig:PackageBox :package="package" titleTag="h2" />
1818
{% endfor %}
1919
</div>
2020
{% endblock %}

0 commit comments

Comments
 (0)