Skip to content

Commit 3658c17

Browse files
committed
accessibility improvements
1 parent fcb2dd2 commit 3658c17

47 files changed

Lines changed: 523 additions & 392 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/App.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,12 @@ li {
5151
white-space: nowrap;
5252
width: 1px;
5353
}
54+
55+
:focus-visible {
56+
outline: 3px solid var(--primary-color, #005fcc);
57+
outline-offset: 2px;
58+
}
59+
60+
input[type='checkbox']:focus-visible {
61+
outline: none;
62+
}

src/LandingPage.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,17 @@ const LandingPage = () => {
3636
<Link
3737
to={'/createview'}
3838
id="create-new-link"
39-
aria-label={t('quickDisplayCreate')}
39+
className="monitor-button blue"
4040
>
41-
<button className="monitor-button blue">
42-
{t('quickDisplayCreate')}
43-
</button>
41+
{t('quickDisplayCreate')}
4442
</Link>
4543
)}
4644
</>
4745
);
4846
return (
4947
<>
5048
<BannerContainer />
51-
<section role="main" id="mainContent">
49+
<main id="mainContent">
5250
{logIn ? (
5351
<Redirect
5452
to={{
@@ -58,7 +56,7 @@ const LandingPage = () => {
5856
) : (
5957
<IndexPage buttons={buttons} renderLogInMessage />
6058
)}
61-
</section>
59+
</main>
6260
</>
6361
);
6462
};

src/i18n.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export const resources = {
6969
'import-instructions':
7070
'Give the URL address of an existing stop display to add it to your displays.',
7171
'import-monitor': 'Import display',
72+
'import-url-label': 'URL address',
7273
'info-display-only-one':
7374
'You can select a service update view only for a display with one stop view.',
7475
'info-text-short': 'Departures in a chronological order',
@@ -129,6 +130,7 @@ export const resources = {
129130
'one-column': 'One column',
130131
open: 'Open the display',
131132
ok: 'OK',
133+
notice: 'Notice',
132134
or: 'or',
133135
'platform-or-stop': 'Platform/Stop',
134136
prepareDisplay: 'Add new stop view',
@@ -162,7 +164,14 @@ export const resources = {
162164
stop: 'Stop',
163165
'stop-display': 'Stop display',
164166
stopSettings: 'Settings for stop {{stop}} ({{code}})',
167+
maptitle: 'Name of the map view',
165168
stoptitle: 'Name of the stop view',
169+
'transport-mode-bus': 'Bus stop',
170+
'transport-mode-tram': 'Tram stop',
171+
'transport-mode-rail': 'Train stop',
172+
'transport-mode-subway': 'Metro stop',
173+
'transport-mode-ferry': 'Ferry stop',
174+
'transport-mode-airplane': 'Airport',
166175
tighten: 'Convergent',
167176
timeShift: 'Filter departures by time',
168177
timeShiftDescription:
@@ -244,6 +253,7 @@ export const resources = {
244253
'import-instructions':
245254
'Anna olemassaolevan pysäkkinäytön URL-osoite, niin voit lisätä sen omiin näyttöihisi',
246255
'import-monitor': 'Tuo näyttö',
256+
'import-url-label': 'URL-osoite',
247257
'info-display-only-one':
248258
'Voit valita tiedotenäytön vain näyttöön, jossa on yksi pysäkkinäkymä.',
249259
'info-text-short': 'Lähdöt aikajärjestyksessä',
@@ -303,6 +313,7 @@ export const resources = {
303313
'one-column': 'Yksi sarake',
304314
open: 'Avaa näyttö',
305315
ok: 'OK',
316+
notice: 'Huomio',
306317
or: 'tai',
307318
'platform-or-stop': 'Lait./Pys.',
308319
prepareDisplay: 'Lisää uusi pysäkkinäkymä',
@@ -337,6 +348,12 @@ export const resources = {
337348
'stop-display': 'Pysäkkinäyttö',
338349
stopSettings: 'Pysäkin {{stop}} {{code}} asetukset',
339350
stoptitle: 'Pysäkkinäkymän nimi',
351+
'transport-mode-bus': 'Bussipysäkki',
352+
'transport-mode-tram': 'Raitiovaunupysäkki',
353+
'transport-mode-rail': 'Juna-asema',
354+
'transport-mode-subway': 'Metroasema',
355+
'transport-mode-ferry': 'Lauttapysäkki',
356+
'transport-mode-airplane': 'Lentokenttä',
340357
tighten: 'Tiivistyvä',
341358
timeShift: 'Rajaa lähtöjä ajan mukaan',
342359
timeShiftDescription:
@@ -418,6 +435,7 @@ export const resources = {
418435
'import-instructions':
419436
'Ange URL-adressen för en existerande hållplatsskärm för att lägga till den i dina skärmar',
420437
'import-monitor': 'Importera skärmen',
438+
'import-url-label': 'URL-adress',
421439
'info-display-only-one':
422440
'Du kan välja meddelandeskärmen endast för en skärm som har bara en hållplatsvy.',
423441
'info-text-short': 'Avgångarna i kronologisk ordning',
@@ -477,6 +495,7 @@ export const resources = {
477495
'one-column': 'En kolumn',
478496
open: 'Öppna skärmen',
479497
ok: 'OK',
498+
notice: 'Observera',
480499
or: 'eller',
481500
'platform-or-stop': 'Plattf./Hållpl.',
482501
prepareDisplay: 'Lägg till ny hållplatsskärm',
@@ -511,7 +530,14 @@ export const resources = {
511530
stop: 'Hållplats',
512531
'stop-display': 'Hållplatsskärm',
513532
stopSettings: 'Inställningar för hållplats {{stop}} ({{code}})',
533+
maptitle: 'Kartvyns namn',
514534
stoptitle: 'Hållplatsskärmens namn',
535+
'transport-mode-bus': 'Busshållplats',
536+
'transport-mode-tram': 'Spårvagnshållplats',
537+
'transport-mode-rail': 'Tågstation',
538+
'transport-mode-subway': 'Metrostation',
539+
'transport-mode-ferry': 'Färjehållplats',
540+
'transport-mode-airplane': 'Flygplats',
515541
tighten: 'Förtätad',
516542
timeShift: 'Välja bort avgångar baserat på tid',
517543
timeShiftDescription:

src/test/IndexPage.test.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ it('should add createView to path when the button is clicked', () => {
4545
});
4646

4747
it('render an image', () => {
48-
const screen = render(<MemoryRouter>{withContext()}</MemoryRouter>);
49-
expect(screen.getAllByAltText('monitor-image').length).toEqual(1);
48+
const { container } = render(<MemoryRouter>{withContext()}</MemoryRouter>);
49+
const img = container.querySelector('img.desktop-img');
50+
expect(img).not.toBeNull();
51+
expect(img.getAttribute('alt')).toBe('');
5052
});

src/test/MonitorRow.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ it('should render a cancelled departure with alert icon and destination', () =>
8787
expect(
8888
container.getElementsByClassName('grid-col destination')[0]?.children[0]
8989
.nodeName,
90-
).toEqual('svg');
90+
).toEqual('SPAN');
9191
});
9292

9393
it('should do show tilde when realtime is off', () => {

src/ui/BurgerMenu.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
margin: 20px;
1717
width: 100%;
1818

19-
#close {
19+
.modal-close-container {
2020
display: flex;
2121
justify-content: flex-end;
2222

src/ui/BurgerMenu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ const BurgerMenu: FC<Props> = ({ createStatic, isOpen, onClose }) => {
9595
contentLabel={t('menuOpen')}
9696
>
9797
<div className="container">
98-
<section id="close">
98+
<section className="modal-close-container">
9999
<button
100100
className="close-button"
101101
aria-label={t('menuClose')}

src/ui/CheckBox.scss

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11

22
.check-box {
3+
position: relative;
34
display: flex;
45
align-items: center;
56
cursor: pointer;
67
margin: 5px;
78

89
input[type="checkbox"] {
9-
clip: rect(0 0 0 0);
10+
position: absolute;
1011
clip-path: inset(50%);
11-
height: 0;
12+
height: 1px;
13+
width: 1px;
1214
overflow: hidden;
1315
white-space: nowrap;
1416
}

src/ui/CreateViewPage.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ const CreateViewPage = () => {
172172
{showMonitorInfoModal && (
173173
<Modal
174174
appElement="#root"
175+
contentLabel={t('notice')}
175176
closeButtonLabel={t('close')}
176177
isOpen
177178
variant="small"

src/ui/DeleteModal.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const DeleteModal: FC<IProps> = ({
2020
return (
2121
<Modal
2222
appElement="#root"
23+
contentLabel={t('delete-display', { id: name })}
2324
closeButtonLabel={t('close')}
2425
isOpen
2526
variant="small"
@@ -34,10 +35,13 @@ const DeleteModal: FC<IProps> = ({
3435
</div>
3536
<div className="monitor-modal-buttons">
3637
<button
37-
disabled={loading}
38+
aria-disabled={loading || undefined}
39+
aria-busy={loading || undefined}
3840
className="monitor-button blue"
39-
aria-label={t('delete-display', { id: name })}
40-
onClick={onDeleteCallBack}
41+
onClick={() => {
42+
if (loading) return;
43+
onDeleteCallBack();
44+
}}
4145
>
4246
{loading ? <Loading small primary /> : <>{t('delete')}</>}
4347
</button>

0 commit comments

Comments
 (0)