Add WCAG 2.2 AA accessibility baseline and browser tests
- Layout: skip link to the main content and a <main> landmark - Home page: stable button label, counter announced via a live status region - Pest browser plugin + Playwright: axe checks (level 2) in light/dark and desktop/mobile, plus a keyboard-only interaction test - Register the Browser test suite in phpunit.xml and Pest.php - CLAUDE.md: accessibility development rules and browser test notes - Boost-refreshed testing-best-practices skill files Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -12,6 +12,21 @@ An ERP / work-management system (*toiminnanohjausjärjestelmä*) for a small (5
|
||||
- **Access control is central.** Roles: admin (*pääkäyttäjä*), management (*johto*), employee (*työntekijä*), intern (*harjoittelija*), subcontractor (*alihankkija*). Employees and interns see only the jobs assigned to them and never see money amounts. Interns have an end date after which they can't log in, plus a supervisor. Subcontractors see only their assigned jobs.
|
||||
- **UI targets:** logged-in users only (no public pages besides login). It must work on phones (new-job intake, time entry) and on FullHD desktops.
|
||||
|
||||
## Accessibility (WCAG 2.2 AA, EN 301 549)
|
||||
|
||||
Accessibility is a contractual acceptance criterion. It covers the whole UI: navigation, forms, tables, reports, notifications, dialogs, login, and every business process. Every new or changed view must meet these rules:
|
||||
|
||||
- Use Flux components first; they ship with correct roles, focus handling and keyboard support. Every form control goes in `flux:field` with a `flux:label` and a `flux:error` (or uses the shorthand `label` prop). Placeholder text is not a label.
|
||||
- Never convey meaning by colour alone. Statuses, priorities (e.g. *kiire* = red), errors and warnings always also have visible text or an icon with text.
|
||||
- Announce dynamic changes: put status text in `role="status"` / `aria-live="polite"` (errors: `role="alert"`), or use Flux toast. Keep button names stable instead of putting changing state in them.
|
||||
- Make everything work with the keyboard alone, with a visible focus indicator and no focus traps. Use `flux:modal` for dialogs, so focus moves in and returns.
|
||||
- The layout (`resources/views/layouts/app.blade.php`) provides a skip link and a `<main id="main-content">` landmark. Keep them, and add `<nav aria-label="…">` for navigation.
|
||||
- One `h1` per page, logical heading order, and a descriptive page `#[Title]` on every page component.
|
||||
- Data tables use `flux:table` with column headers. Icon-only buttons need an accessible name (`aria-label` or Flux `tooltip`). Decorative images get `alt=""`.
|
||||
- Contrast is at least 4.5:1 for text and 3:1 for UI components and focus indicators, in both light and dark mode.
|
||||
- Layouts must reflow at 320 px width and 400 % zoom without horizontal scrolling. Touch targets are at least 24×24 px.
|
||||
- Every new page gets a browser test in `tests/Browser` that uses `assertNoAccessibilityIssues(level: 2)` in light and dark mode and on desktop and mobile. See `tests/Browser/AccessibilityTest.php`. Automated axe checks catch only part of WCAG: also check new flows manually with the keyboard and a screen reader (NVDA).
|
||||
|
||||
## Commands
|
||||
|
||||
```powershell
|
||||
@@ -25,6 +40,7 @@ vendor/bin/pint --dirty --format agent
|
||||
|
||||
- Runs under XAMPP: Apache on port 8080 serves the app at `http://localhost:8080/toiminnanohjaus/public` (this is `APP_URL`). The database is XAMPP MariaDB 10.11 `toiminnanohjaus` (root, no password).
|
||||
- Tests use in-memory SQLite with array cache/session/mail and the sync queue. `phpunit.xml` sets `APP_URL=http://localhost`, because the subfolder `APP_URL` makes test requests 404.
|
||||
- Browser tests (`tests/Browser`, Pest browser plugin with Playwright Chromium) run against built assets, so run `npm run build` first. Run only them with `php artisan test --compact tests/Browser`. They need PHP's `sockets` extension (enabled in `C:\xampp\php\php.ini`). In the plugin's `click`/`keys` methods, a selector is treated as CSS only if it starts with `#`, `.` or `[`, or contains a CSS combinator (`html > body`). Otherwise it is matched as visible text, so `button` or `main button` time out.
|
||||
- Apache serves built assets from `public/build`, so run `npm run build` after CSS/Blade class changes. A leftover `public/hot` file from a stopped `npm run dev` breaks all styling: delete it.
|
||||
- Session, cache and queue use the `database` driver locally, so their tables come from the default migrations.
|
||||
- Laravel Boost MCP is configured in `.mcp.json` (`php artisan boost:mcp`). `AGENTS.md` is a copy of the Boost guidelines below for other agents (opencode).
|
||||
|
||||
Reference in New Issue
Block a user