Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
👷 Add standing axe-core accessibility check to CI (WCAG 2.1 A/AA) (#2572)
Luke Vella9a24eb6353ba
diff --git a/apps/web/package.json b/apps/web/package.jsonindex 0430fe259..fd54c671e 100644--- a/apps/web/package.json+++ b/apps/web/package.json@@ -107,6 +107,7 @@"zxcvbn": "^4.4.2"},"devDependencies": {+ "@axe-core/playwright": "^4.12.1","@babel/core": "^7.26.10","@next/bundle-analyzer": "16.2.6","@playwright/test": "^1.57.0",diff --git a/apps/web/src/components/poll/desktop-poll/poll-header.tsx b/apps/web/src/components/poll/desktop-poll/poll-header.tsxindex adbef18c6..ece8a21d4 100644--- a/apps/web/src/components/poll/desktop-poll/poll-header.tsx+++ b/apps/web/src/components/poll/desktop-poll/poll-header.tsx@@ -26,7 +26,7 @@ const TimeRange: React.FunctionComponent<{><span data-testid="option-start-time">{start}</span><Tooltip delayDuration={0}>- <TooltipTrigger className="flex items-center gap-x-1 opacity-50">+ <TooltipTrigger className="flex items-center gap-x-1"><ClockIcon className="size-3" />{duration}</TooltipTrigger>@@ -165,7 +165,7 @@ const PollHeader = () => {duration={option.duration}/>) : (- <p className="font-normal text-muted-foreground text-xs opacity-50">+ <p className="font-normal text-muted-foreground text-xs"><Trans i18nKey="allDay" defaults="All-Day" /></p>)}diff --git a/apps/web/src/components/poll/mobile-poll/time-slot-option.tsx b/apps/web/src/components/poll/mobile-poll/time-slot-option.tsxindex 5ebebfa6d..9f4e6c5b5 100644--- a/apps/web/src/components/poll/mobile-poll/time-slot-option.tsx+++ b/apps/web/src/components/poll/mobile-poll/time-slot-option.tsx@@ -19,7 +19,7 @@ const TimeSlotOption: React.FunctionComponent<TimeSlotOptionProps> = ({<PollOption {...rest}><div className="flex items-center gap-x-4 text-sm"><div>{startTime}</div>- <div className="flex items-center gap-x-1.5 opacity-50">+ <div className="flex items-center gap-x-1.5 text-muted-foreground"><ClockIcon className="size-4" />{duration}</div>diff --git a/apps/web/tests/accessibility.spec.ts b/apps/web/tests/accessibility.spec.tsnew file mode 100644index 000000000..fa119b70a--- /dev/null+++ b/apps/web/tests/accessibility.spec.ts@@ -0,0 +1,73 @@+import AxeBuilder from "@axe-core/playwright";+import type { Page } from "@playwright/test";+import { expect, test } from "@playwright/test";+import { NewPollPage } from "./new-poll-page";++/**+ * Standing accessibility regression check (RAL-1233).+ *+ * Runs axe-core against the pages covered by the ACR evidence scans. Scope is+ * WCAG 2.1 A/AA. If this fails, either fix the violation or — only for issues+ * already documented in the ACR remediation backlog — add a scoped exclusion+ * with a reference to the relevant finding.+ */+const WCAG_TAGS = ["wcag2a", "wcag2aa", "wcag21a", "wcag21aa"];++async function scan(page: Page) {+ // Settle animations and in-flight requests so contrast sampling is+ // deterministic.+ await page.emulateMedia({ reducedMotion: "reduce" });+ await page.waitForLoadState("networkidle");+ const results = await new AxeBuilder({ page }).withTags(WCAG_TAGS).analyze();+ return results.violations.map((violation) => ({+ id: violation.id,+ impact: violation.impact,+ help: violation.help,+ nodes: violation.nodes.map((node) => node.target.join(" ")),+ }));+}++test.describe("accessibility (axe-core, WCAG 2.1 A/AA)", () => {+ test("login page", async ({ page }) => {+ await page.goto("/login");+ await page.getByText("Welcome").waitFor();+ expect(await scan(page)).toEqual([]);+ });++ test("register page", async ({ page }) => {+ await page.goto("/register");+ await page.getByRole("heading", { name: "Create Your Account" }).waitFor();+ expect(await scan(page)).toEqual([]);+ });++ test.describe("invite page", () => {+ let inviteUrl: string;++ test.beforeAll(async ({ browser }) => {+ const page = await browser.newPage();+ const newPollPage = new NewPollPage(page);+ await newPollPage.goto();+ const dialog = await newPollPage.create({ name: "Accessibility Scan" });+ await dialog.goToPollPage();+ const match = page.url().match(/\/poll\/([a-zA-Z0-9]+)/);+ if (!match) {+ throw new Error(`could not extract poll id from ${page.url()}`);+ }+ inviteUrl = `/invite/${match[1]}`;+ await page.close();+ });++ test("desktop layout", async ({ page }) => {+ await page.goto(inviteUrl);+ await page.getByTestId("vote-selector").first().waitFor();+ expect(await scan(page)).toEqual([]);+ });++ test("mobile layout", async ({ page }) => {+ await page.setViewportSize({ width: 375, height: 667 });+ await page.goto(inviteUrl);+ await page.getByTestId("vote-selector").first().waitFor();+ expect(await scan(page)).toEqual([]);+ });+ });+});diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex f5a6f9e26..0d38416f9 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -448,6 +448,9 @@ importers:specifier: ^4.4.2version: 4.4.2devDependencies:+ '@axe-core/playwright':+ specifier: ^4.12.1+ version: 4.12.1([email protected])'@babel/core':specifier: ^7.26.10version: 7.29.0@@ -1121,6 +1124,11 @@ packages:resolution: {integrity: sha512-oLvsaPMTBejkkmHhjf09xTgk71mOqyr/409NKhRIL08If7AhVfUsJhVsx386uJaqNd42v9kWamQ9lFbkoC2dYw==}engines: {node: '>=18.0.0'}+ '@axe-core/[email protected]':+ resolution: {integrity: sha512-rMd7xriptqKpP+w5265i4Hdkv2X5kbu6uiBi/B2I7uf3hieRBM3qDCfaKPtxfiYb2mKXfF+yLODJwIx+Jv1GDw==}+ peerDependencies:+ playwright-core: '>= 1.0.0'+'@babel/[email protected]':resolution: {integrity: sha512-9NhCeYjq9+3uxgdtp20LSiJXJvN0FeCtNGpJxuMFZ1Kv3cWUNb6DOhJwUvcVCzKGR66cw4njwM6hrJLqgOwbcw==}engines: {node: '>=6.9.0'}@@ -6504,6 +6512,10 @@ packages:resolution: {integrity: sha512-NZKeq9AfyQvEeNlN0zSYAaWrmBffJh3IELMZfRpJVWgrpEbtEpnjvzqBPf+mxoI287JohRDoa+/nsfqqiZmF6g==}engines: {node: '>= 6.0.0'}+ resolution: {integrity: sha512-s7iGf5GaVMxEG0ENN9x+xTr7GFZCb1ZP/1uATUpCEK2X78nDB3RwbtFCo9pGAf9ru+VwoQ464DkaLEeRM08wJA==}+ engines: {node: '>=4'}+resolution: {integrity: sha512-/1xYAC4MP/HEG+3duIhFr4ZQXR4sQXOIe+o6sdqzeykGLx6Upp/1p8MHqhINOvGeP7xyNHe7tsiJByc4SSVUxw==}@@ -12203,6 +12215,11 @@ snapshots:'@aws/[email protected]': {}+ '@axe-core/[email protected]([email protected])':+ dependencies:+ axe-core: 4.12.1+ playwright-core: 1.58.1+'@babel/[email protected]':dependencies:'@babel/helper-validator-identifier': 7.28.5@@ -18479,6 +18496,8 @@ snapshots:+ [email protected]: {}+dependencies:follow-redirects: 1.15.11