Accessibility pass, WCAG 2.2 AA (1.50.0)
Public pages, auth, registration, payment, My Events and the kiosk: skip link, focus ring, labels tied to fields, named quantity buttons, announced errors, ModalOverlay popups (focus trap, Escape, focus return), contrast and underlined in-text links, reduced motion. Branding warns about a primary colour too light for white text and offers a darker shade. axe-core and keyboard checks in e2e/accessibility.spec.ts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -11,6 +11,7 @@ import { errorMessage } from "@/lib/utils";
|
||||
import type { Event, PublicBundle, Registration } from "@/types";
|
||||
import { choosesSessions, isPickOption } from "@/lib/sessions";
|
||||
import { SessionPicker } from "@/components/events/SessionPicker";
|
||||
import { ModalOverlay } from "@/components/shared/ModalOverlay";
|
||||
|
||||
// ─── Types ────────────────────────────────────────────────────────────────────
|
||||
type EarlyBirdTier = { deadline: string; price: number; order?: number; variantId?: string | null };
|
||||
@@ -116,8 +117,7 @@ function PasswordToggleButton({ shown, onToggle }: { shown: boolean; onToggle: (
|
||||
<button
|
||||
type="button"
|
||||
onClick={onToggle}
|
||||
tabIndex={-1}
|
||||
className="absolute inset-y-0 right-0 flex items-center px-4 text-gray-400 hover:text-gray-600"
|
||||
className="absolute inset-y-0 right-0 flex items-center px-4 text-gray-500 hover:text-gray-700"
|
||||
aria-label={shown ? "Hide password" : "Show password"}
|
||||
>
|
||||
{shown ? (
|
||||
@@ -693,7 +693,7 @@ export default function SelfServicePage() {
|
||||
|
||||
// ─── Render ──────────────────────────────────────────────────────
|
||||
return (
|
||||
<div className="min-h-screen bg-gray-50 flex flex-col">
|
||||
<main className="min-h-screen bg-gray-50 flex flex-col">
|
||||
{/* Change Event button */}
|
||||
{screen === "form" && (
|
||||
<div className="fixed top-3 right-3 z-50">
|
||||
@@ -708,15 +708,16 @@ export default function SelfServicePage() {
|
||||
|
||||
{/* ── Change Event Modal ─────────────────────────────────────── */}
|
||||
{showChangeModal && (
|
||||
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/40">
|
||||
<ModalOverlay labelledBy="kiosk-change-title" onClose={() => setShowChangeModal(false)}>
|
||||
<div className="bg-white rounded-2xl shadow-2xl p-8 w-full max-w-sm mx-4">
|
||||
<h2 className="text-xl font-bold text-gray-800 mb-1">Change Event</h2>
|
||||
<h2 id="kiosk-change-title" className="text-xl font-bold text-gray-800 mb-1">Change Event</h2>
|
||||
<p className="text-sm text-gray-500 mb-5">Re-enter your password to change the event.</p>
|
||||
<form onSubmit={handleChangeEvent} className="space-y-4">
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-1">Password</label>
|
||||
<label htmlFor="kiosk-password" className="block text-sm font-medium text-gray-700 mb-1">Password</label>
|
||||
<div className="relative">
|
||||
<input
|
||||
id="kiosk-password"
|
||||
type={showChangePassword ? "text" : "password"}
|
||||
value={changePassword}
|
||||
onChange={(e) => setChangePassword(e.target.value)}
|
||||
@@ -728,7 +729,7 @@ export default function SelfServicePage() {
|
||||
<PasswordToggleButton shown={showChangePassword} onToggle={() => setShowChangePassword((v) => !v)} />
|
||||
</div>
|
||||
</div>
|
||||
{changeError && <p className="text-red-600 text-sm">{changeError}</p>}
|
||||
{changeError && <p role="alert" className="text-red-600 text-sm">{changeError}</p>}
|
||||
<div className="flex gap-3 pt-1">
|
||||
<button
|
||||
type="button"
|
||||
@@ -747,7 +748,7 @@ export default function SelfServicePage() {
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</ModalOverlay>
|
||||
)}
|
||||
|
||||
{/* ── Setup Screen ───────────────────────────────────────────── */}
|
||||
@@ -762,8 +763,9 @@ export default function SelfServicePage() {
|
||||
{!isLoggedIn && (
|
||||
<form onSubmit={handleSetupLogin} className="space-y-5">
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-1">Email</label>
|
||||
<label htmlFor="kiosk-email" className="block text-sm font-medium text-gray-700 mb-1">Email</label>
|
||||
<input
|
||||
id="kiosk-email"
|
||||
type="email"
|
||||
value={setupEmail}
|
||||
onChange={(e) => setSetupEmail(e.target.value)}
|
||||
@@ -774,9 +776,10 @@ export default function SelfServicePage() {
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-1">Password</label>
|
||||
<label htmlFor="kiosk-password-2" className="block text-sm font-medium text-gray-700 mb-1">Password</label>
|
||||
<div className="relative">
|
||||
<input
|
||||
id="kiosk-password-2"
|
||||
type={showSetupPassword ? "text" : "password"}
|
||||
value={setupPassword}
|
||||
onChange={(e) => setSetupPassword(e.target.value)}
|
||||
@@ -790,8 +793,9 @@ export default function SelfServicePage() {
|
||||
</div>
|
||||
{setupChallenge && (
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-1">Verification code</label>
|
||||
<label htmlFor="kiosk-verification-code" className="block text-sm font-medium text-gray-700 mb-1">Verification code</label>
|
||||
<input
|
||||
id="kiosk-verification-code"
|
||||
type="text"
|
||||
inputMode="numeric"
|
||||
autoComplete="one-time-code"
|
||||
@@ -816,7 +820,7 @@ export default function SelfServicePage() {
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
{setupError && <p className="text-red-600 text-sm">{setupError}</p>}
|
||||
{setupError && <p role="alert" className="text-red-600 text-sm">{setupError}</p>}
|
||||
<button
|
||||
type="submit"
|
||||
disabled={setupLoading}
|
||||
@@ -836,8 +840,9 @@ export default function SelfServicePage() {
|
||||
<p className="text-gray-500 text-center py-4">Loading events…</p>
|
||||
) : (
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-1">Event</label>
|
||||
<label htmlFor="kiosk-event" className="block text-sm font-medium text-gray-700 mb-1">Event</label>
|
||||
<select
|
||||
id="kiosk-event"
|
||||
value={selectedEventId}
|
||||
onChange={(e) => setSelectedEventId(e.target.value)}
|
||||
className="w-full border border-gray-300 rounded-xl px-4 py-3 text-base focus:outline-none focus:ring-2 focus:ring-brand-500"
|
||||
@@ -885,12 +890,13 @@ export default function SelfServicePage() {
|
||||
|
||||
<form onSubmit={handleRegisterSubmit} className="space-y-5">
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-1">
|
||||
<label htmlFor="kiosk-email-address" className="block text-sm font-medium text-gray-700 mb-1">
|
||||
Email Address
|
||||
{!visitorPhone.trim() && <span className="text-red-500"> *</span>}
|
||||
{visitorPhone.trim() && <span className="text-gray-400 font-normal"> (optional if phone provided)</span>}
|
||||
{visitorPhone.trim() && <span className="text-gray-500 font-normal"> (optional if phone provided)</span>}
|
||||
</label>
|
||||
<input
|
||||
id="kiosk-email-address"
|
||||
type="email"
|
||||
value={visitorEmail}
|
||||
onChange={(e) => {
|
||||
@@ -906,12 +912,13 @@ export default function SelfServicePage() {
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-1">
|
||||
<label htmlFor="kiosk-cell-number" className="block text-sm font-medium text-gray-700 mb-1">
|
||||
Cell Number
|
||||
{!visitorEmail.trim() && <span className="text-red-500"> *</span>}
|
||||
{visitorEmail.trim() && <span className="text-gray-400 font-normal"> (optional if email provided)</span>}
|
||||
{visitorEmail.trim() && <span className="text-gray-500 font-normal"> (optional if email provided)</span>}
|
||||
</label>
|
||||
<input
|
||||
id="kiosk-cell-number"
|
||||
type="tel"
|
||||
value={visitorPhone}
|
||||
onChange={(e) => {
|
||||
@@ -943,8 +950,9 @@ export default function SelfServicePage() {
|
||||
)}
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-1">Full Name <span className="text-red-500">*</span></label>
|
||||
<label htmlFor="kiosk-full-name" className="block text-sm font-medium text-gray-700 mb-1">Full Name <span className="text-red-500">*</span></label>
|
||||
<input
|
||||
id="kiosk-full-name"
|
||||
type="text"
|
||||
value={visitorName}
|
||||
onChange={(e) => setVisitorName(e.target.value)}
|
||||
@@ -957,13 +965,14 @@ export default function SelfServicePage() {
|
||||
{/* Preference selector — only shown when both channels are available */}
|
||||
{visitorEmail.trim() && visitorPhone.trim() && (
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-2">Send tickets via</label>
|
||||
<div className="flex rounded-xl border border-gray-200 overflow-hidden text-sm font-medium">
|
||||
<p id="kiosk-send-via" className="block text-sm font-medium text-gray-700 mb-2">Send tickets via</p>
|
||||
<div role="group" aria-labelledby="kiosk-send-via" className="flex rounded-xl border border-gray-200 overflow-hidden text-sm font-medium">
|
||||
{(["email", "whatsapp", "both"] as const).map((p) => (
|
||||
<button
|
||||
key={p}
|
||||
type="button"
|
||||
onClick={() => setNotificationPref(p)}
|
||||
aria-pressed={notificationPref === p}
|
||||
className={`flex-1 py-3 transition-colors ${
|
||||
notificationPref === p
|
||||
? p === "whatsapp" ? "bg-green-600 text-white"
|
||||
@@ -982,7 +991,7 @@ export default function SelfServicePage() {
|
||||
{/* Ticket options */}
|
||||
{(selectedEvent.eventOptions || []).length > 0 && (
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-3">Ticket Options</label>
|
||||
<h2 className="block text-sm font-medium text-gray-700 mb-3">Ticket Options</h2>
|
||||
<BundleOffers bundles={kioskBundles} className="mb-3" />
|
||||
<div className="space-y-3">
|
||||
{(selectedEvent.eventOptions || []).map((opt) => {
|
||||
@@ -1012,14 +1021,16 @@ export default function SelfServicePage() {
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setQuantities((q) => ({ ...q, [key]: Math.max(0, (q[key] || 0) - 1) }))}
|
||||
aria-label={`Remove one ${opt.name} (${v.name})`}
|
||||
className="w-10 h-10 rounded-full border-2 border-gray-300 text-xl font-bold text-gray-600 hover:bg-gray-100 flex items-center justify-center transition"
|
||||
>
|
||||
−
|
||||
</button>
|
||||
<span className="w-8 text-center text-lg font-semibold">{quantities[key] || 0}</span>
|
||||
<span className="w-8 text-center text-lg font-semibold" aria-live="polite">{quantities[key] || 0}</span>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setQuantities((q) => ({ ...q, [key]: (q[key] || 0) + 1 }))}
|
||||
aria-label={`Add one ${opt.name} (${v.name})`}
|
||||
className="w-10 h-10 rounded-full border-2 border-brand-500 text-xl font-bold text-brand-600 hover:bg-brand-50 flex items-center justify-center transition"
|
||||
>
|
||||
+
|
||||
@@ -1046,14 +1057,16 @@ export default function SelfServicePage() {
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setQuantities((q) => ({ ...q, [opt.id]: Math.max(0, (q[opt.id] || 0) - 1) }))}
|
||||
aria-label={`Remove one ${opt.name}`}
|
||||
className="w-10 h-10 rounded-full border-2 border-gray-300 text-xl font-bold text-gray-600 hover:bg-gray-100 flex items-center justify-center transition"
|
||||
>
|
||||
−
|
||||
</button>
|
||||
<span className="w-8 text-center text-lg font-semibold">{quantities[opt.id] || 0}</span>
|
||||
<span className="w-8 text-center text-lg font-semibold" aria-live="polite">{quantities[opt.id] || 0}</span>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setQuantities((q) => ({ ...q, [opt.id]: (q[opt.id] || 0) + 1 }))}
|
||||
aria-label={`Add one ${opt.name}`}
|
||||
className="w-10 h-10 rounded-full border-2 border-brand-500 text-xl font-bold text-brand-600 hover:bg-brand-50 flex items-center justify-center transition"
|
||||
>
|
||||
+
|
||||
@@ -1119,23 +1132,30 @@ export default function SelfServicePage() {
|
||||
</div>
|
||||
) : (
|
||||
<div className="border border-gray-200 rounded-xl px-4 py-4">
|
||||
<label className="flex items-center gap-3 cursor-pointer">
|
||||
<div
|
||||
onClick={() => setCreateAccount((v) => !v)}
|
||||
className={`relative w-12 h-6 rounded-full transition-colors ${createAccount ? "bg-brand-600" : "bg-gray-300"}`}
|
||||
<button
|
||||
type="button"
|
||||
role="switch"
|
||||
aria-checked={createAccount}
|
||||
onClick={() => setCreateAccount((v) => !v)}
|
||||
className="flex items-center gap-3 cursor-pointer text-left w-full"
|
||||
>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className={`relative shrink-0 w-12 h-6 rounded-full transition-colors ${createAccount ? "bg-brand-600" : "bg-gray-500"}`}
|
||||
>
|
||||
<span className={`absolute top-0.5 left-0.5 w-5 h-5 bg-white rounded-full shadow transition-transform ${createAccount ? "translate-x-6" : ""}`} />
|
||||
</div>
|
||||
<div>
|
||||
<p className="font-medium text-gray-800">Create an account</p>
|
||||
<p className="text-sm text-gray-500">Save your details for future events</p>
|
||||
</div>
|
||||
</label>
|
||||
</span>
|
||||
<span>
|
||||
<span className="block font-medium text-gray-800">Create an account</span>
|
||||
<span className="block text-sm text-gray-500">Save your details for future events</span>
|
||||
</span>
|
||||
</button>
|
||||
{createAccount && (
|
||||
<div className="mt-3">
|
||||
<label className="block text-sm font-medium text-gray-700 mb-1">Choose a password</label>
|
||||
<label htmlFor="kiosk-choose-a-password" className="block text-sm font-medium text-gray-700 mb-1">Choose a password</label>
|
||||
<div className="relative">
|
||||
<input
|
||||
id="kiosk-choose-a-password"
|
||||
type={showVisitorPassword ? "text" : "password"}
|
||||
value={visitorPassword}
|
||||
onChange={(e) => setVisitorPassword(e.target.value)}
|
||||
@@ -1151,7 +1171,7 @@ export default function SelfServicePage() {
|
||||
)}
|
||||
|
||||
{formError && (
|
||||
<div className="bg-red-50 border border-red-200 rounded-xl px-4 py-3 text-red-700 text-sm">
|
||||
<div role="alert" className="bg-red-50 border border-red-200 rounded-xl px-4 py-3 text-red-700 text-sm">
|
||||
{formError}
|
||||
</div>
|
||||
)}
|
||||
@@ -1170,9 +1190,9 @@ export default function SelfServicePage() {
|
||||
|
||||
{/* ── Confirm Account Changes Modal ──────────────────────────── */}
|
||||
{showUpdateConfirm && (
|
||||
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/40">
|
||||
<ModalOverlay labelledBy="kiosk-confirm-title" onClose={() => setShowUpdateConfirm(false)}>
|
||||
<div className="bg-white rounded-2xl shadow-2xl p-8 w-full max-w-sm mx-4">
|
||||
<h2 className="text-xl font-bold text-gray-800 mb-1">Confirm account changes</h2>
|
||||
<h2 id="kiosk-confirm-title" className="text-xl font-bold text-gray-800 mb-1">Confirm account changes</h2>
|
||||
<p className="text-sm text-gray-500 mb-5">
|
||||
These details differ from what's on file for this account. Confirm to update them.
|
||||
</p>
|
||||
@@ -1180,7 +1200,7 @@ export default function SelfServicePage() {
|
||||
{pendingChanges.map((c) => (
|
||||
<div key={c.field} className="border border-gray-200 rounded-lg px-3 py-2">
|
||||
<p className="text-xs font-semibold text-gray-500 uppercase tracking-wide">{c.field}</p>
|
||||
<p className="text-sm text-gray-400 line-through">{c.from}</p>
|
||||
<p className="text-sm text-gray-500 line-through">{c.from}</p>
|
||||
<p className="text-sm text-green-700 font-medium">{c.to}</p>
|
||||
</div>
|
||||
))}
|
||||
@@ -1202,7 +1222,7 @@ export default function SelfServicePage() {
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ModalOverlay>
|
||||
)}
|
||||
|
||||
{/* ── Event Form Screen ──────────────────────────────────────── */}
|
||||
@@ -1241,7 +1261,7 @@ export default function SelfServicePage() {
|
||||
<form onSubmit={handleFormSubmit} className="space-y-5">
|
||||
{answerableFields.map((field) => (
|
||||
<div key={field.id}>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-1">
|
||||
<label htmlFor={`kiosk-field-${field.id}`} className="block text-sm font-medium text-gray-700 mb-1">
|
||||
{field.label}
|
||||
{field.isRequired && <span className="text-red-500 ml-1">*</span>}
|
||||
</label>
|
||||
@@ -1251,7 +1271,7 @@ export default function SelfServicePage() {
|
||||
{isExtraFieldType(field.type) ? (
|
||||
<ExtraFieldInput field={field} value={currentTicketAnswers[field.id] || ""} onChange={v => setCurrentTicketAnswers(a => ({ ...a, [field.id]: v }))} />
|
||||
) : field.type === "yes_no" ? (
|
||||
<div className="flex gap-4">
|
||||
<div className="flex gap-4" role="radiogroup" aria-label={field.label}>
|
||||
{["Yes", "No"].map((opt) => (
|
||||
<label key={opt} className="flex items-center gap-2 cursor-pointer">
|
||||
<input
|
||||
@@ -1269,6 +1289,7 @@ export default function SelfServicePage() {
|
||||
</div>
|
||||
) : field.type === "numeric" ? (
|
||||
<input
|
||||
id={`kiosk-field-${field.id}`}
|
||||
type="number"
|
||||
value={currentTicketAnswers[field.id] || ""}
|
||||
onChange={e => setCurrentTicketAnswers(a => ({ ...a, [field.id]: e.target.value }))}
|
||||
@@ -1277,6 +1298,7 @@ export default function SelfServicePage() {
|
||||
/>
|
||||
) : field.type === "date" ? (
|
||||
<input
|
||||
id={`kiosk-field-${field.id}`}
|
||||
type="date"
|
||||
value={currentTicketAnswers[field.id] || ""}
|
||||
onChange={e => setCurrentTicketAnswers(a => ({ ...a, [field.id]: e.target.value }))}
|
||||
@@ -1285,6 +1307,7 @@ export default function SelfServicePage() {
|
||||
/>
|
||||
) : field.type === "paragraph" ? (
|
||||
<textarea
|
||||
id={`kiosk-field-${field.id}`}
|
||||
value={currentTicketAnswers[field.id] || ""}
|
||||
onChange={e => setCurrentTicketAnswers(a => ({ ...a, [field.id]: e.target.value }))}
|
||||
required={field.isRequired}
|
||||
@@ -1293,6 +1316,7 @@ export default function SelfServicePage() {
|
||||
/>
|
||||
) : (
|
||||
<input
|
||||
id={`kiosk-field-${field.id}`}
|
||||
type="text"
|
||||
value={currentTicketAnswers[field.id] || ""}
|
||||
onChange={e => setCurrentTicketAnswers(a => ({ ...a, [field.id]: e.target.value }))}
|
||||
@@ -1304,7 +1328,7 @@ export default function SelfServicePage() {
|
||||
))}
|
||||
|
||||
{formSubmitError && (
|
||||
<div className="bg-red-50 border border-red-200 rounded-xl px-4 py-3 text-red-700 text-sm">
|
||||
<div role="alert" className="bg-red-50 border border-red-200 rounded-xl px-4 py-3 text-red-700 text-sm">
|
||||
{formSubmitError}
|
||||
</div>
|
||||
)}
|
||||
@@ -1382,6 +1406,6 @@ export default function SelfServicePage() {
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user