diff --git a/README.md b/README.md index 972db5e..44799c6 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Kork & Krone -**Last updated:** 16 November 2026 +**Last updated:** 17 November 2026 **Submission:** 4 (working system, ready for feedback on every aspect) **Status:** In progress. See [Status for submission 4](#status-for-submission-4). @@ -230,10 +230,11 @@ Our goal is WCAG 2.1 level AA. We design for users with reduced vision, hearing, - Playwright with axe-core against WCAG 2.1 A and AA, on desktop and mobile. - An automated test for reflow at 320 px. - Manual testing with only the keyboard. +- Screen reader flows: Playwright steps through the flows and checks where focus goes and what the live regions say, for example after removing a filter, a failed login or saving a review. See [screen reader testing](docs/screen-reader.md) for what we found and fixed, and the script for testing by hand with VoiceOver. ### Some known gaps -- We have not tested with a screen reader yet. +- VoiceOver has been run automated (11 of 15 steps passed, see the [VoiceOver report](docs/voiceover-report.md)), but not yet by hand. Empty required fields are read as «invalid data» before the user has done anything. See [screen reader testing](docs/screen-reader.md). - eslint-plugin-jsx-a11y is not set up yet. ## Sustainability @@ -411,5 +412,6 @@ Remove known issues as they are fixed. - [VM](docs/vm.md): deployment, Apache and running the backend with `nohup` - [API](docs/api.md): GraphQL queries, user accounts, reviews, database tests and the X-Wines citation - [Manual testing](docs/manual-testing.md): how to test login, reviews and other user data by hand +- [Screen reader testing](docs/screen-reader.md): what we found, what we fixed and the VoiceOver script - [Workflow](docs/workflow.md): branches, reviews and checks - [Tasks](docs/tasks.md): requirements and sketches \ No newline at end of file diff --git a/docs/screen-reader.md b/docs/screen-reader.md new file mode 100644 index 0000000..ec73deb --- /dev/null +++ b/docs/screen-reader.md @@ -0,0 +1,106 @@ +# Screen reader testing + +How we test Kork & Krone with a screen reader, what we found, and what is still left to check. Issue #47. + +## How we test + +Three parts, because none is enough on its own. + +1. **The accessibility tree, automated.** A screen reader reads the accessibility tree that the browser builds from the page, not the page itself. We read that tree for every page and step through each flow in Chromium (Playwright), and record after every action where focus is and what the live regions say. The flows that matter are in `frontend/e2e/screenreader.spec.ts`, so they stay fixed. +2. **The real VoiceOver, automated.** `npm run voiceover` runs the script below with VoiceOver and records what it says. The result is in the [VoiceOver report](voiceover-report.md). This shows how VoiceOver phrases things and whether live regions are announced, which the accessibility tree cannot. +3. **A person with VoiceOver.** The automated run cannot judge whether something is understandable, too long or annoying. Someone in the group goes through the script by hand before each submission. + +## What we found and fixed + +Found by stepping through the flows. Each one has a test that fails without the fix. + +| Where | Problem | Fix | +| ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------- | +| Search: active filters | Removing a filter removed the link the user was on. Focus fell back to the top of the page, so the screen reader started from the top again. | Focus moves to the next filter, or to the h1 when none are left. | +| Search: «Nullstill filtre» and the links when nothing matched | Same: the link disappears with the click. | Focus moves to the h1, and the live region reads the new result. | +| Wine page: saving or deleting a review | The buttons are disabled while saving, and the form is rebuilt after the first save. Focus was lost both times. | Focus goes back to the submit button once the result has been announced. | +| Wine page: saving a review | The page announced «Laster vin …» while it refreshed, and showed a skeleton above the wine. | Only the first load is announced and shown. | +| Login | The button was disabled while logging in, so focus was lost when the login failed. | `aria-disabled` instead of `disabled`, so focus stays on the button. Double clicks are still ignored. | +| Login: «Lag bruker» / «Logg inn» | The form changed, but focus stayed on the switch button, so nothing told the user which form they were in. | Focus moves to the new h1, and the page title changes with it. | +| Lag bruker: the password field | «Minst 8 tegn.» was shown under the field but not read with it. Only the username had its hint linked. | `aria-describedby` on the password field too. | +| Mine anmeldelser: removing a wine from «Vil prøve» | The card disappeared with the button, focus was lost, and nothing was announced. | The live region says «Fjernet fra listen. 1 vin igjen.», and focus moves to the list heading. | +| All pages, in development only | React StrictMode runs effects twice, so focus jumped to the h1 on the very first load. Production did not do this, so testing on the dev server gave a different result. | The layout compares with the previous path instead of counting renders. | + +Checked and fine: landmarks, one h1 per page, focus on the h1 after navigation, page titles, names on all buttons and form fields, «Vil prøve» as a toggle button (`aria-pressed`), the star rating as ten radio buttons, star ratings as text, the filter dialog (focus inside, Escape closes, focus back to the button), «Last inn flere» (focus on the first new wine), and the live regions for search results, loading and errors. + +## Automated test with VoiceOver + +[Guidepup](https://www.guidepup.dev/) controls VoiceOver and records every phrase it says. Playwright opens the app in WebKit, the engine in Safari, and moves focus and presses keys like a keyboard user. Each step in the script below has the phrases we expect, and the report marks the steps that did not say them. Only on macOS. + +Once per machine, in your own terminal, from `frontend/` after `npm install`: + + npx @guidepup/setup setup + npx @guidepup/setup install voiceover + +The first command lets VoiceOver be controlled with AppleScript, and asks for Accessibility and Automation permission for the terminal (or the app that runs the command). The second downloads the VoiceOver settings that Guidepup uses during the run, and only works where `@guidepup/guidepup` is installed, which is why it runs from `frontend/`. Your own VoiceOver settings are put back afterwards. + +Then start the backend and the dev server, and run from `frontend/`: + + npm run voiceover # all steps + npm run voiceover -- 5,9 # only steps 5 and 9 + +VoiceOver talks while it runs, and the keyboard and mouse should be left alone until it is done. The report is written to [docs/voiceover-report.md](voiceover-report.md). Commit it, so the latest result is in the repository. + +## Manual test with VoiceOver + +Use VoiceOver on macOS with **Safari**, the combination most VoiceOver users have. Test against the dev server with the backend running, or against the VM. `npm run preview` has no API proxy, so the data does not load there. + +- Turn VoiceOver on and off: Cmd + F5. +- VO is Ctrl + Option. VO + arrow keys read the next or previous item. +- VO + U opens the rotor, with lists of headings, links, landmarks and form controls. +- Tab moves between controls. Space or Enter uses them. + +For each step, write down what VoiceOver says if it differs from the expected result. + +| # | Step | Expected | +| --- | ------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | +| 1 | Open the front page. Open the rotor and look at landmarks and headings. | Banner, «Hovedmeny», main and footer. One h1, then h2 for each section. | +| 2 | Tab once from the top. | «Hopp til hovedinnhold, lenke». Enter goes to the main content. | +| 3 | Type «pinot» in the search field and press Enter. | The new page is announced with its h1, «Utforsk viner». Then «Viser … viner for «pinot»». | +| 4 | Go to the first wine card with VO + arrows. | Type and country, the name as a heading and link, the winery, «Fellesskapet 4,9 av 5 · 8 vurderinger», and «Vil prøve …, toggle button». | +| 5 | Tick «Rødvin» in the filters with Space. | «Rødvin, 11 viner, checked» (not «unchecked»), then the new number of hits. | +| 6 | Tab to «Fjern filteret Rødvin» and press Enter. | Focus on the next filter, or on «Utforsk viner» if it was the last. Then the new number of hits. | +| 7 | Search for «finnesikke». | «Ingen treff», and the text that explains why, with the suggestions. | +| 8 | Open a wine. Find «Gi din dom» and use the arrow keys in the stars. | «0,5 av 5 stjerner, radio button, 1 of 10», and so on up to 5. | +| 9 | Choose 4 stars, write a comment, press «Lagre dommen». | «Dommen er lagret.» Focus on «Oppdater dommen». | +| 10 | Press «Slett dommen». | «Dommen er slettet.» Focus on «Lagre dommen». | +| 11 | Press «Vil prøve» on the wine page, then go to «Mine anmeldelser» and press it again on the card. | «Fjernet fra listen. Listen er tom.» Focus on «Vil prøve, heading level 2». | +| 12 | Go to «Logg inn», log in with a wrong password. | «Feil brukernavn eller passord.» Focus still on «Logg inn». | +| 13 | Press «Lag bruker». | «Lag bruker, heading level 1». The field hints are read with the fields. | +| 14 | On a phone-sized window: open «Filtrer», choose a filter, close with «Vis … viner». | The dialog is announced with its heading, and focus goes back to «Filtrer (1 valgt)». | +| 15 | Turn off the network (Wi-Fi) and search. | «Du er frakoblet …», and the error message says what is wrong. | + +### Results + +| Date | How | Browser and screen reader | Result | +| ----------- | ------------------------------ | ----------------------------------- | ------------------------------------------------------------- | +| 16 Nov 2026 | Automated, `npm run voiceover` | WebKit 27.2 + VoiceOver, macOS 26.6 | 11 of 15 steps passed. See the [report](voiceover-report.md). | +| | By hand | Safari + VoiceOver (macOS) | Not run yet | + +## What the VoiceOver run found + +Fixed: + +- **Lists were not read as lists.** Safari and VoiceOver ignore the list role on a `