Skip to content

Commit c6110f5

Browse files
author
Sine Jespersen
authored
Merge pull request #58 from itk-dev/feature/accessibility-overhaul
Feature/accessibility overhaul
2 parents 2e94ffa + 2175871 commit c6110f5

25 files changed

+344
-171
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## Unreleased
99

10+
- [PR-58](https://github.com/itk-dev/aapodwalk/pull/58)
11+
- This pr handles accessibility
12+
- Add [focus trap](https://www.npmjs.com/package/focus-trap-react) for "modals"
13+
- Add skip link for main navigation
14+
- Lock open street map on "presentation" mode
15+
- Juggle a little contrast (we are now AA, not AAA)
16+
- Add ARIA-labels and aria-hidden on decorative stuff
1017
- [PR-57](https://github.com/itk-dev/aapodwalk/pull/57)
1118
- Improve lightmode
1219
- [PR-56](https://github.com/itk-dev/aapodwalk/pull/56)

package-lock.json

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

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"@fortawesome/free-solid-svg-icons": "^6.7.1",
1010
"@fortawesome/react-fontawesome": "^0.2.2",
1111
"@vitejs/plugin-react": "^4.3.0",
12+
"focus-trap-react": "^11.0.1",
1213
"leaflet": "^1.9.4",
1314
"ol": "^7.4.0",
1415
"proj4": "^2.9.0",

src/App.jsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import RoutePage from "./components/routes/RoutePage";
99
import RoutePoints from "./components/routes/RoutePoints";
1010
import PersonalInformationPolicyPage from "./components/PersonalInformationPolicyPage";
1111
import Navbar from "./components/Navbar";
12+
import SkipLinks from "./components/SkipLinks";
1213
import FAQ from "./components/FAQ";
1314
import SeeOnMap from "./components/SeeOnMap";
1415
import ErrorContext from "./context/ErrorContext";
@@ -76,8 +77,12 @@ function App() {
7677
[selectedRoute, nextUnlockablePointId, listOfUnlocked],
7778
)}
7879
>
80+
<SkipLinks />
7981
<Navbar />
80-
<div className="relative grow overflow-hidden">
82+
<main id="main" className="relative grow overflow-hidden">
83+
<a id="main-content" href="/" tabIndex="-1" className="sr-only">
84+
Hovedindhold
85+
</a>
8186
<ErrorContext.Provider
8287
value={useMemo(
8388
() => ({
@@ -116,7 +121,7 @@ function App() {
116121
</Route>
117122
</Switch>
118123
</ErrorContext.Provider>
119-
</div>
124+
</main>
120125
</RouteContext.Provider>
121126
</PermissionContext.Provider>
122127
</LatLongContext.Provider>

src/components/CloseButton.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import { faClose } from "@fortawesome/free-solid-svg-icons";
55
function CloseButton({ closeOverlay, label = "luk", additionalClasses = "" }) {
66
return (
77
<button
8-
className={`flex place-content-center items-center text-sm absolute right-3 rounded-full top-3 z-50 w-9 h-9 ${additionalClasses}`}
8+
className={`${additionalClasses} flex place-content-center items-center text-sm absolute right-3 rounded-full top-3 w-9 h-9`}
99
type="button"
1010
onClick={() => closeOverlay()}
1111
>
12-
<FontAwesomeIcon className="z-50 w-5 h-5" icon={faClose} />
12+
<FontAwesomeIcon className="z-40 w-5 h-5" icon={faClose} />
1313
<span className="sr-only">{label}</span>
1414
</button>
1515
);

src/components/FAQ.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ const FAQ = () => {
1717
</section>
1818
<section className="bg-emerald-400 dark:bg-zinc-900 flex flex-row relative my-2 rounded font-bold p-5 flex flex-col mt-5">
1919
Sådan bruger du navigationen
20-
<Link to={"/navigation-help"} className="text-zinc-900 dark:text-emerald-800 font-bold underline mt-3">
20+
<Link to={"/navigation-help"} className="text-zinc-900 dark:text-emerald-600 font-bold underline mt-3">
2121
Vedledning til navigation
2222
</Link>
2323
</section>
2424
<section className="bg-emerald-400 dark:bg-zinc-900 flex flex-row relative my-2 rounded font-bold p-5 flex flex-col mt-5">
2525
Tilgængelighedserklæring
26-
<Link className="text-zinc-900 dark:text-emerald-800 font-bold underline mt-5">
26+
<Link className="text-zinc-900 dark:text-emerald-600 font-bold underline mt-5">
2727
{/* todo add Tilgængelighedserklæring */}
2828
Tilgængelighed og en erklæring herom
2929
</Link>

src/components/LandingPage.jsx

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { React, useState, useEffect } from "react";
22
import Steps from "../icons/steps.svg?url";
3-
import Xmark from "../icons/xmark-solid.svg?url";
3+
import CloseButton from "./CloseButton";
44

55
const LandingPage = () => {
66
const [infoClosed, setInfoClosed] = useState(localStorage.getItem("info-closed") === "true");
@@ -23,16 +23,13 @@ const LandingPage = () => {
2323
</p>
2424
<p className="mt-5 font-bold">Vælg en rute nedenfor og start din lytteoplevelse.</p>
2525
</div>
26+
<CloseButton
27+
label="Luk introduktion"
28+
closeOverlay={() => setInfoClosed(true)}
29+
additionalClasses="flex justify-center items-center dark:bg-emerald-700 w-9 h-9 rounded-full justify-content-center z-40"
30+
/>
2631
<div className="w-2/5 flex justify-center relative">
27-
<button
28-
className="flex justify-center items-center dark:bg-emerald-700 dark:text-white absolute right-0 top-0 w-9 h-9 rounded-full justify-content-center"
29-
type="button"
30-
onClick={() => setInfoClosed(true)}
31-
>
32-
<img src={Xmark} alt="" className="w-6 h-6" />
33-
<span className="sr-only">Luk introduktion</span>
34-
</button>
35-
<img src={Steps} alt="Tilbage" />
32+
<img src={Steps} alt="" />
3633
</div>
3734
</div>
3835
);

src/components/MapConsentBanner.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function MapConsentBanner() {
1616
return (
1717
<div className="fixed left-3 bottom-3 right-3 dark:bg-zinc-600 flex flex-col gap-3 rounded-lg p-3 bg-zinc-300">
1818
<div>
19-
<h2 className="mb-1 font-bold">Samtykke</h2>
19+
<h2 className="mb-1 font-bold text-xl">Samtykke</h2>
2020
<div className="mt-1 flex flex-col">
2121
<div className="flex flex-col gap-2">
2222
<p>

src/components/Navbar.jsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,14 @@ const Navbar = () => {
99
const { pathname } = useLocation();
1010

1111
return (
12-
<div className="fixed top-0 left-0 right-0 p-2 bg-zinc-100 dark:bg-zinc-800 z-40">
12+
<nav className="fixed top-0 left-0 right-0 p-3 bg-zinc-100 dark:bg-zinc-800 z-50">
1313
<div className="mb-6 mt-4 flex justify-between">
14-
{pathname === "/" && <img src={Logo} alt="" className="w-10 h-10" />}
14+
{pathname === "/" && (
15+
<Link to="/">
16+
<span className="sr-only">Hjem</span>
17+
<img src={Logo} alt="" className="w-10 h-10" />
18+
</Link>
19+
)}
1520
{pathname !== "/" && <BackButton />}
1621
<Link
1722
className="flex place-content-center rounded-full text-xl w-9 h-9 bg-emerald-400 dark:bg-black justify-center items-center"
@@ -21,7 +26,7 @@ const Navbar = () => {
2126
<span className="sr-only">FAQ</span>
2227
</Link>
2328
</div>
24-
</div>
29+
</nav>
2530
);
2631
};
2732

src/components/SkipLinks.jsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { React } from "react";
2+
3+
const SkipLinks = () => {
4+
return (
5+
<section>
6+
<a className="sr-only focus:not-sr-only" href="#main-content">
7+
Gå til hovedindhold
8+
</a>
9+
</section>
10+
);
11+
};
12+
13+
export default SkipLinks;

0 commit comments

Comments
 (0)