Mobiel menu als donker overlay zonder de pagina te verschuiven, sticky balk onder sm, skiplink, focusring en h1 met screenreader-tekst
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
- **Feature Slug**: redesign-modern-timetravel
|
- **Feature Slug**: redesign-modern-timetravel
|
||||||
- **Project Type**: Brownfield
|
- **Project Type**: Brownfield
|
||||||
- **Start Date**: 2026-11-09T13:00:00Z
|
- **Start Date**: 2026-11-09T13:00:00Z
|
||||||
- **Current Stage**: CONSTRUCTION - U4 contact-form Code Generation plan (awaiting approval)
|
- **Current Stage**: CONSTRUCTION - U4 contact-form Code Generation (awaiting approval)
|
||||||
- **Branch**: feature/redesign-modern-timetravel
|
- **Branch**: feature/redesign-modern-timetravel
|
||||||
|
|
||||||
## Workspace State
|
## Workspace State
|
||||||
|
|||||||
@@ -718,3 +718,39 @@
|
|||||||
**Context**: Code Generation Part 1 for U4.
|
**Context**: Code Generation Part 1 for U4.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## U4 Code Generation Complete
|
||||||
|
|
||||||
|
**Timestamp**: 2026-11-10T21:00:00Z
|
||||||
|
|
||||||
|
**User Input**: "Approve plan"
|
||||||
|
|
||||||
|
**AI Response**: "Executed all 9 steps of contact-form-code-generation-plan.md. Tests 14 files/154 before, 19 files/239 after, all passed; lint 0 errors (2 pre-existing warnings, boundary rule active); build OK. Two real defects found and fixed by tests (errors inside labels, focus while inputs disabled). Committed on feature/redesign-modern-timetravel, no push. Summary at construction/contact-form/code/summary.md. Deviation: mail address not assembled after mount. Builder released to rebase on master e671078 (PR 11 merged by CMS and API)."
|
||||||
|
|
||||||
|
**Context**: Code Generation U4 complete; awaiting approval before U5.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Builder Rebase Accepted; CMS-U5, U6, U7 Plans Approved
|
||||||
|
|
||||||
|
**Timestamp**: 2026-11-10T22:00:00Z
|
||||||
|
|
||||||
|
**User Input**: "(cross-session message from SLS Software - CMS: rebase done, plans CMS-U5/U6/U7; all three plan files read in full)"
|
||||||
|
|
||||||
|
**AI Response**: "Accepted the rebase on origin/master e671078 (15 commits ahead; follow-up commits: ClientPartitionKey in KeyFor, System/capabilities public marker, test repairs for ActiveUserTokenValidation, OpenAPI regenerated; tests Api.Andrea 11, Api 4, Core 625, Availability 154, Contact 225, Identity 145, Master 61, Offerings 86 green). Approved CMS-U5 (mail via new MailKind, additive changes in shared mail code with unchanged existing tests, recipient from environment only, backoff 5m/15m/1h/6h/24h, max 6), CMS-U6 (Berichten UI; opening marks as read; chips; no sidebar badge now), CMS-U7 (PUT /availability/status without alias; GET/HEAD-only bypass; one release with the admin app). Order U7, U5, U6. ASF session informed about the additive shared mail changes."
|
||||||
|
|
||||||
|
**Context**: Leading the builder; CMS phase 2 started.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Interim Test Deploy, Runner-label PR, CMS-U8 Request
|
||||||
|
|
||||||
|
**Timestamp**: 2026-11-11T09:00:00Z
|
||||||
|
|
||||||
|
**User Input**: "kan ik een tussentijdse build zien? Kan je bijvoorbeeld deployen naar test met de nieuwe website?" / "Akkoord, ga verder. Ik zie trouwens dat de Aanbieding toevoegen-knop in het CMS op mobiel te breed is. Misschien dat we die naar icon-only kunnen veranderen of misschien beter een FAB? Dat kunnen we dan meteen mee laten nemen door de CMS-sessie"
|
||||||
|
|
||||||
|
**AI Response**: "Pushed feature/redesign-modern-timetravel (no PR) and dispatched the CI workflow on it with deploy_test only: run 640 succeeded (deploy-test success, production skipped). Runner-label change for slp-modular-cms: ASF CMS session prepared branch ci/linux-runner-independent-jobs (fac6d30); with the user approval PR 12 was created (not merged); baseline run 634 durations recorded (backend-build 311s, backend-test 462s, vulnerability-scan 264s, frontend-prepare 93s, build 122s, test 373s, lint 112s, publish-test 367s). Builder asked for CMS-U8: Aanbieding toevoegen as FAB on mobile and Categorieen beheren icon-only, after CMS-U6."
|
||||||
|
|
||||||
|
**Context**: Interim test build; CMS pipeline coordination.
|
||||||
|
|
||||||
|
---
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { navLinks } from '../../features/landing/data/content';
|
import { navLinks } from '../../features/landing/data/content';
|
||||||
import { ModeToggle } from '../ui/ModeToggle';
|
import { ModeToggle } from '../ui/ModeToggle';
|
||||||
import { VariantToggle } from '../ui/VariantToggle';
|
import { VariantToggle } from '../ui/VariantToggle';
|
||||||
@@ -11,13 +11,23 @@ import { handleAnchorClick } from '../../utils/scrollToHash';
|
|||||||
export function Nav() {
|
export function Nav() {
|
||||||
const [isMenuOpen, setIsMenuOpen] = useState(false);
|
const [isMenuOpen, setIsMenuOpen] = useState(false);
|
||||||
|
|
||||||
|
// Escape closes the mobile menu (keyboard users).
|
||||||
|
useEffect(() => {
|
||||||
|
if (!isMenuOpen) return;
|
||||||
|
const onKey = (event: KeyboardEvent) => {
|
||||||
|
if (event.key === 'Escape') setIsMenuOpen(false);
|
||||||
|
};
|
||||||
|
document.addEventListener('keydown', onKey);
|
||||||
|
return () => document.removeEventListener('keydown', onKey);
|
||||||
|
}, [isMenuOpen]);
|
||||||
|
|
||||||
function handleMobileLinkClick(event: React.MouseEvent<HTMLAnchorElement>, href: string) {
|
function handleMobileLinkClick(event: React.MouseEvent<HTMLAnchorElement>, href: string) {
|
||||||
handleAnchorClick(event, href);
|
handleAnchorClick(event, href);
|
||||||
setIsMenuOpen(false);
|
setIsMenuOpen(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<nav aria-label="Hoofdnavigatie" className="bg-brand text-on-brand">
|
<nav aria-label="Hoofdnavigatie" className="sticky top-0 z-40 bg-brand text-on-brand sm:static">
|
||||||
<div className="mx-auto flex min-h-[84px] max-w-[1280px] items-center justify-between gap-6 px-6 sm:px-8">
|
<div className="mx-auto flex min-h-[84px] max-w-[1280px] items-center justify-between gap-6 px-6 sm:px-8">
|
||||||
<a
|
<a
|
||||||
href="#top"
|
href="#top"
|
||||||
@@ -93,7 +103,7 @@ export function Nav() {
|
|||||||
<ul
|
<ul
|
||||||
id="mobile-nav-menu"
|
id="mobile-nav-menu"
|
||||||
data-testid="nav-mobile-menu"
|
data-testid="nav-mobile-menu"
|
||||||
className="flex flex-col gap-1 border-t border-white/30 px-6 py-3 sm:hidden"
|
className="absolute inset-x-0 top-full z-40 flex flex-col gap-1 border-t border-white/30 bg-inv px-6 py-3 text-white shadow-[0_12px_24px_rgba(0,0,0,0.35)] sm:hidden"
|
||||||
>
|
>
|
||||||
{navLinks.map((link) => (
|
{navLinks.map((link) => (
|
||||||
<li key={link.href}>
|
<li key={link.href}>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import type { ReactNode } from 'react';
|
import type { ReactNode } from 'react';
|
||||||
import { Nav } from './Nav';
|
import { Nav } from './Nav';
|
||||||
import { Footer } from './Footer';
|
import { Footer } from './Footer';
|
||||||
|
import { SkipLink } from './SkipLink';
|
||||||
import { VariantRenderer } from './VariantRenderer';
|
import { VariantRenderer } from './VariantRenderer';
|
||||||
import { TransitionOverlay } from './TransitionOverlay';
|
import { TransitionOverlay } from './TransitionOverlay';
|
||||||
import { LiveRegion } from './LiveRegion';
|
import { LiveRegion } from './LiveRegion';
|
||||||
@@ -17,6 +18,7 @@ export function RootLayout({ children }: { children: ReactNode }) {
|
|||||||
<VariantRenderer
|
<VariantRenderer
|
||||||
b={
|
b={
|
||||||
<>
|
<>
|
||||||
|
<SkipLink />
|
||||||
<header>
|
<header>
|
||||||
<Nav />
|
<Nav />
|
||||||
</header>
|
</header>
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/**
|
||||||
|
* "Naar de inhoud" link for keyboard and screen-reader users (WCAG 2.4.1). Hidden until focused.
|
||||||
|
* Handled in script because the app uses hash routing (a plain #main anchor would be taken by the
|
||||||
|
* router, see utils/scrollToHash).
|
||||||
|
*/
|
||||||
|
export function SkipLink() {
|
||||||
|
return (
|
||||||
|
<a
|
||||||
|
href="#main"
|
||||||
|
onClick={(event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
const main = document.getElementById('main');
|
||||||
|
main?.focus();
|
||||||
|
main?.scrollIntoView({ block: 'start' });
|
||||||
|
}}
|
||||||
|
className="sr-only z-50 bg-white px-4 py-3 text-base font-bold text-[#0e0d0d] focus:not-sr-only focus:fixed focus:left-4 focus:top-4"
|
||||||
|
data-testid="skip-link"
|
||||||
|
>
|
||||||
|
Naar de inhoud
|
||||||
|
</a>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -63,6 +63,24 @@ describe('Nav', () => {
|
|||||||
expect(screen.queryByTestId('nav-mobile-menu')).not.toBeInTheDocument();
|
expect(screen.queryByTestId('nav-mobile-menu')).not.toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('shows the mobile menu as a dark overlay below the bar that does not push the page, and closes on Escape', () => {
|
||||||
|
renderNav();
|
||||||
|
fireEvent.click(screen.getByTestId('nav-mobile-toggle'));
|
||||||
|
const menu = screen.getByTestId('nav-mobile-menu');
|
||||||
|
expect(menu).toHaveClass('absolute', 'top-full', 'bg-inv');
|
||||||
|
fireEvent.keyDown(document, { key: 'Escape' });
|
||||||
|
expect(screen.queryByTestId('nav-mobile-menu')).not.toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('keeps the bar visible while scrolling on small screens only', () => {
|
||||||
|
renderNav();
|
||||||
|
expect(screen.getByRole('navigation', { name: 'Hoofdnavigatie' })).toHaveClass(
|
||||||
|
'sticky',
|
||||||
|
'top-0',
|
||||||
|
'sm:static',
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it('closes the mobile menu when a link inside it is clicked', () => {
|
it('closes the mobile menu when a link inside it is clicked', () => {
|
||||||
renderNav();
|
renderNav();
|
||||||
fireEvent.click(screen.getByTestId('nav-mobile-toggle'));
|
fireEvent.click(screen.getByTestId('nav-mobile-toggle'));
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { render, screen, within } from '@testing-library/react';
|
import { fireEvent, render, screen, within } from '@testing-library/react';
|
||||||
import { describe, expect, it } from 'vitest';
|
import { describe, expect, it, vi } from 'vitest';
|
||||||
import { RootLayout } from '../RootLayout';
|
import { RootLayout } from '../RootLayout';
|
||||||
import { ThemeProvider } from '../../../theme/ThemeProvider';
|
import { ThemeProvider } from '../../../theme/ThemeProvider';
|
||||||
|
|
||||||
@@ -40,6 +40,15 @@ describe('RootLayout landmarks (NFR-1)', () => {
|
|||||||
expect(screen.getByTestId('variant-toggle-button')).toHaveClass('text-on-brand');
|
expect(screen.getByTestId('variant-toggle-button')).toHaveClass('text-on-brand');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('offers a skip link that moves focus to the main region', () => {
|
||||||
|
Element.prototype.scrollIntoView = vi.fn();
|
||||||
|
renderLayout();
|
||||||
|
const skip = screen.getByTestId('skip-link');
|
||||||
|
expect(skip).toHaveAttribute('href', '#main');
|
||||||
|
fireEvent.click(skip);
|
||||||
|
expect(document.activeElement).toBe(screen.getByRole('main'));
|
||||||
|
});
|
||||||
|
|
||||||
it('has a live region for variant announcements', () => {
|
it('has a live region for variant announcements', () => {
|
||||||
renderLayout();
|
renderLayout();
|
||||||
expect(screen.getByRole('status')).toBeInTheDocument();
|
expect(screen.getByRole('status')).toBeInTheDocument();
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ export function AboutSection() {
|
|||||||
alt="Bryan Slop, oprichter van SLP Software"
|
alt="Bryan Slop, oprichter van SLP Software"
|
||||||
width={480}
|
width={480}
|
||||||
height={640}
|
height={640}
|
||||||
|
loading="lazy"
|
||||||
|
decoding="async"
|
||||||
className="relative block aspect-[3/4] w-full object-cover object-[50%_30%]"
|
className="relative block aspect-[3/4] w-full object-cover object-[50%_30%]"
|
||||||
/>
|
/>
|
||||||
</picture>
|
</picture>
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ export function ContactSection() {
|
|||||||
<h2
|
<h2
|
||||||
id="contact-heading"
|
id="contact-heading"
|
||||||
className="text-[clamp(56px,10.5vw,168px)] font-extrabold leading-[0.88] tracking-[-0.03em] [font-stretch:125%]"
|
className="text-[clamp(56px,10.5vw,168px)] font-extrabold leading-[0.88] tracking-[-0.03em] [font-stretch:125%]"
|
||||||
aria-label={contactInfo.heading}
|
|
||||||
>
|
>
|
||||||
|
<span className="sr-only">{contactInfo.heading}</span>
|
||||||
{contactInfo.displayHeading.map((line) => (
|
{contactInfo.displayHeading.map((line) => (
|
||||||
<span key={line} className="block" aria-hidden="true">
|
<span key={line} className="block" aria-hidden="true">
|
||||||
{line}
|
{line}
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ export function Hero() {
|
|||||||
<h1
|
<h1
|
||||||
id="hero-heading"
|
id="hero-heading"
|
||||||
className="text-[clamp(56px,10.5vw,168px)] font-extrabold leading-[0.88] tracking-[-0.03em] [font-stretch:125%]"
|
className="text-[clamp(56px,10.5vw,168px)] font-extrabold leading-[0.88] tracking-[-0.03em] [font-stretch:125%]"
|
||||||
aria-label={heroContent.heading}
|
|
||||||
>
|
>
|
||||||
|
<span className="sr-only">{heroContent.heading}</span>
|
||||||
{heroContent.displayHeading.map((line, index) => (
|
{heroContent.displayHeading.map((line, index) => (
|
||||||
<span
|
<span
|
||||||
key={line}
|
key={line}
|
||||||
|
|||||||
@@ -113,6 +113,13 @@ html {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Clear keyboard focus on every interactive element (WCAG 2.4.7); uses the text colour of the
|
||||||
|
surrounding block so it is visible on the brand-red header and on light/dark panels. */
|
||||||
|
:where(a, button, select, input, textarea, [tabindex]):focus-visible {
|
||||||
|
outline: 2px solid currentColor;
|
||||||
|
outline-offset: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
background-color: var(--color-bg);
|
background-color: var(--color-bg);
|
||||||
color: var(--color-text);
|
color: var(--color-text);
|
||||||
|
|||||||
Reference in New Issue
Block a user