From 978170cb031f9cfc02a1ffe87910eab7db2a93b6 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Thu, 12 Nov 2026 23:09:14 +0900 Subject: [PATCH] =?UTF-8?q?test(a11y):=20=EC=A0=91=EA=B7=BC=EC=84=B1=20?= =?UTF-8?q?=EC=9E=90=EB=8F=99=20=EA=B2=80=EC=82=AC=EA=B0=80=20=EC=A7=80?= =?UTF-8?q?=ED=82=A4=EB=8A=94=20=EA=B7=9C=EC=B9=99=EC=97=90=20=EC=8B=A4?= =?UTF-8?q?=EC=A0=9C=EB=A1=9C=20=EB=8B=BF=EA=B2=8C=20=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 접근성 자동 검사 셋이 지키는 것에 닿지 않는다. - reduced-motion e2e가 body의 animationDuration으로 브라우저 기본값 0s도 받아들인다. responsive.css의 reduced-motion 규칙을 지워도 통과한다(1112/05-08). - 예제 화면을 Storybook 갤러리로 옮기면서 화면 전체 axe 검사가 빠졌다. 기능이 없는 템플릿에서 빈·오류·로그인·권한 표면이 axe를 받지 않는다(05-04). - 제품이 WCAG 2.2 AA를 약속하는데 스캔 태그는 2.1까지다. 같은 태그 목록이 네 곳에 손으로 적혀 있다(05-05 일부). - 셸 compact drawer는 modal이고 모든 셸 route에 있는데, 라우트 수동 기록 셋과 checklist 예시가 M4를 "modal 없음"으로 채운다(05-07). 고른 방법: reduced-motion 시험은 규칙이 없을 때의 값(0s)과 규칙의 값 (0.01ms)을 함께 본다. 갤러리 두 story를 light·dark에서 화면 전체 axe로 본다. 태그는 tests/support/browser/axe-tags.ts 하나에 두고 wcag22aa를 더한다. 라우트 기록의 M4를 pending으로 바꾸고 checklist에 셸 drawer를 적는다. 수동 기록 양식에 2.4.11·2.5.8 칸을 더하는 일(05-05의 나머지)은 양식과 생성 출력이 바뀌는 일이라 이 커밋에 넣지 않았다. R9-D9(권하는 안으로 정함 (2026-11-12, 총괄))에 따라 따로 한다. 위험·한계: wcag22aa는 axe의 target-size 규칙만 더한다. 포커스 가림(2.4.11) 같은 기준은 여전히 수동이다. 검증: reduced-motion 시험이 규칙을 지운 변이에서 실패하고 원래 코드에서 통과한다. 갤러리 axe 넷과 FE-GATE-009는 desktop에서 돈다(PR 본문). Refs: 1112/05-04, 1112/05-05, 1112/05-07, 1112/05-08 --- .claude/skills/fe-a11y/SKILL.md | 2 +- docs/accessibility/manual-checklist.md | 6 ++-- docs/accessibility/route-reviews/APP_HOME.md | 2 +- .../route-reviews/EXAMPLES_PLATFORM.md | 2 +- docs/accessibility/route-reviews/NOT_FOUND.md | 2 +- tests/e2e/accessibility.spec.ts | 25 +++++++++++++---- tests/e2e/generated-feature.spec.ts | 3 +- tests/e2e/theme.spec.ts | 3 +- tests/storybook/galleries.spec.ts | 28 ++++++++++++++++++- tests/support/browser/axe-tags.ts | 13 +++++++++ 10 files changed, 71 insertions(+), 15 deletions(-) create mode 100644 tests/support/browser/axe-tags.ts diff --git a/.claude/skills/fe-a11y/SKILL.md b/.claude/skills/fe-a11y/SKILL.md index eb80cea5..d3b2def6 100644 --- a/.claude/skills/fe-a11y/SKILL.md +++ b/.claude/skills/fe-a11y/SKILL.md @@ -23,7 +23,7 @@ paths: ## 함정 -1. axe 통과를 접근성 완료로 적는다. e2e 스캔의 태그는 `wcag2a`·`wcag2aa`·`wcag21a`·`wcag21aa`뿐이다. WCAG 2.2에서 더해진 기준(포커스가 가려지지 않음, 목표 크기 최소, 드래그 대안 등)은 자동으로 보지 않는다. 그리고 critical·serious 위반만 막는다. — `tests/e2e/accessibility.spec.ts`, `docs/accessibility/manual-checklist.md`, `docs/design/2026-07-26-design-system-platform-design.md` 13절 +1. axe 통과를 접근성 완료로 적는다. 스캔 태그는 `tests/support/browser/axe-tags.ts` 하나다. WCAG 2.2 AA 태그(`wcag22aa`, 목표 크기 2.5.8)도 돌지만, 2.2에서 더해진 기준 대부분(포커스가 가려지지 않음, 드래그 대안 등)은 axe에 규칙이 없어 자동으로 보지 않는다. 그리고 critical·serious 위반만 막는다. — `tests/e2e/accessibility.spec.ts`, `docs/accessibility/manual-checklist.md`, `docs/design/2026-07-26-design-system-platform-design.md` 13절 2. 자동 스캔이 본 상태를 넘겨 짐작한다. 보호 라우트는 데모 로그인 뒤, 목록은 빈 상태, 단건 읽기 상세는 실패 상태에서 스캔하고 `notChecked`로 남긴다. 데이터가 찬 목록·상세는 기능 시험과 수동 검토 몫이다. — `docs/accessibility/manual-checklist.md` 「자동 실행이 검사하는 것」 3. 린트가 의미를 잡아 줄 거라 믿는다. `eslint.config.ts`에 접근성 규칙 플러그인이 없다. `div` + 키 핸들러로 만든 버튼, 이름 없는 아이콘 버튼은 component 시험·axe·리뷰가 잡는다. — `eslint.config.ts`, `docs/design/2026-07-26-design-system-platform-design.md` 13절 4. 저장 중 버튼을 `disabled`로 바꿔 키보드 포커스를 잃게 한다. `pending`을 쓴다. — `docs/manual/02-decision-tables.md` 6절 diff --git a/docs/accessibility/manual-checklist.md b/docs/accessibility/manual-checklist.md index 85f320e3..cb83f5b9 100644 --- a/docs/accessibility/manual-checklist.md +++ b/docs/accessibility/manual-checklist.md @@ -38,7 +38,7 @@ Attestation: accepted M1 Keyboard: pass M2 Visible focus: pass M3 Route focus: pass -M4 Modal focus: not-applicable (no modal on this route) +M4 Modal focus: pass M5 Error association: not-applicable (no form error on this route) M6 Color signal: pass M7 Reduced motion: pass @@ -58,7 +58,9 @@ Notes: - Screen reader: 제목, live region, 오류, 동작이 한 번씩 읽힌다 form이나 dialog가 있는 route는 M4 modal 리뷰와 M5 필드 오류 리뷰를 실제로 해야 -한다. 그런 route에서는 그 항목을 not-applicable로 표시하면 안 된다. 자동 증거가 +한다. 그런 route에서는 그 항목을 not-applicable로 표시하면 안 된다. 셸(`AppShell`)의 +compact 탐색 drawer는 modal이고 셸 아래 모든 route에 있으므로, 셸 route의 M4는 +not-applicable이 아니다. 자동 증거가 통과했다는 것은 이것만 뜻한다: 기록된 Chromium, Firefox, WebKit 실행에서 테스트한 페이지에 critical이나 serious 등급의 axe 발견이 없었다. diff --git a/docs/accessibility/route-reviews/APP_HOME.md b/docs/accessibility/route-reviews/APP_HOME.md index 12a847a9..033989c1 100644 --- a/docs/accessibility/route-reviews/APP_HOME.md +++ b/docs/accessibility/route-reviews/APP_HOME.md @@ -10,7 +10,7 @@ Attestation: pending M1 Keyboard: pending M2 Visible focus: pending M3 Route focus: pending -M4 Modal focus: not-applicable (no modal on this route) +M4 Modal focus: pending M5 Error association: not-applicable (no form error on this route) M6 Color signal: pending M7 Reduced motion: pending diff --git a/docs/accessibility/route-reviews/EXAMPLES_PLATFORM.md b/docs/accessibility/route-reviews/EXAMPLES_PLATFORM.md index d6280cbe..28d9d6d0 100644 --- a/docs/accessibility/route-reviews/EXAMPLES_PLATFORM.md +++ b/docs/accessibility/route-reviews/EXAMPLES_PLATFORM.md @@ -10,7 +10,7 @@ Attestation: pending M1 Keyboard: pending M2 Visible focus: pending M3 Route focus: pending -M4 Modal focus: not-applicable (no modal on this route) +M4 Modal focus: pending M5 Error association: not-applicable (no form error on this route) M6 Color signal: pending M7 Reduced motion: pending diff --git a/docs/accessibility/route-reviews/NOT_FOUND.md b/docs/accessibility/route-reviews/NOT_FOUND.md index f69a7836..729ae595 100644 --- a/docs/accessibility/route-reviews/NOT_FOUND.md +++ b/docs/accessibility/route-reviews/NOT_FOUND.md @@ -10,7 +10,7 @@ Attestation: pending M1 Keyboard: pending M2 Visible focus: pending M3 Route focus: pending -M4 Modal focus: not-applicable (no modal on this route) +M4 Modal focus: pending M5 Error association: not-applicable (no form error on this route) M6 Color signal: pending M7 Reduced motion: pending diff --git a/tests/e2e/accessibility.spec.ts b/tests/e2e/accessibility.spec.ts index 1c631214..81fcbd97 100644 --- a/tests/e2e/accessibility.spec.ts +++ b/tests/e2e/accessibility.spec.ts @@ -9,8 +9,9 @@ import { answerInstalledApiRequest, type InstalledApiAnswer, } from "./support/installed-api-answers.ts"; +import { WCAG_AXE_TAGS } from "../support/browser/axe-tags.ts"; -const WCAG_TAGS = ["wcag2a", "wcag2aa", "wcag21a", "wcag21aa"]; +const WCAG_TAGS = [...WCAG_AXE_TAGS]; const SIGN_IN_TITLE = KO_MESSAGES["route.auth.required.title"]; const CATALOG = KO_MESSAGES as Readonly>; @@ -127,11 +128,23 @@ test("@a11y skip link moves keyboard focus into main", async ({ page }) => { .toBe(true); }); +// 1112/05-08. The policy is the reduced-motion rule (responsive.css): every +// animation and transition becomes 0.01 ms. The browser default is 0s, so the +// check reads the rule's own value and compares it with the default, or a +// deleted rule passes. test("@a11y reduced-motion policy disables long animation", async ({ page }) => { - await page.emulateMedia({ reducedMotion: "reduce" }); + const durations = () => + page.locator("body").evaluate((body) => { + const style = getComputedStyle(body); + return [style.animationDuration, style.transitionDuration]; + }); + const REDUCED = ["0.00001s", "1e-05s"]; await page.goto("/"); - const duration = await page - .locator("body") - .evaluate((body) => getComputedStyle(body).animationDuration); - expect(["0s", "0.00001s", "1e-05s"]).toContain(duration); + expect(await durations()).toEqual(["0s", "0s"]); + + await page.emulateMedia({ reducedMotion: "reduce" }); + + const [animation, transition] = await durations(); + expect(REDUCED).toContain(animation); + expect(REDUCED).toContain(transition); }); diff --git a/tests/e2e/generated-feature.spec.ts b/tests/e2e/generated-feature.spec.ts index f80d424f..96115049 100644 --- a/tests/e2e/generated-feature.spec.ts +++ b/tests/e2e/generated-feature.spec.ts @@ -1,5 +1,6 @@ import AxeBuilder from "@axe-core/playwright"; import type { Page, Route } from "@playwright/test"; +import { WCAG_AXE_TAGS } from "../support/browser/axe-tags.ts"; import { KO_MESSAGES } from "../../src/presentation/i18n/catalog.ts"; import { expect, test } from "../support/browser/strict-browser-test.ts"; @@ -28,7 +29,7 @@ import { startBuildServer } from "./support/service-worker-builds.ts"; */ const META = Object.freeze({ requestId: "req-e2e", traceId: "0af7651916cd43dd8448eb211c80319c" }); const ITEM = Object.freeze({ id: "browser-order", name: "Browser order" }); -const WCAG_TAGS = ["wcag2a", "wcag2aa", "wcag21a", "wcag21aa"]; +const WCAG_TAGS = [...WCAG_AXE_TAGS]; let builds: FixtureBuilds<"a"> | undefined; let server: Awaited> | undefined; diff --git a/tests/e2e/theme.spec.ts b/tests/e2e/theme.spec.ts index b1dd6f1a..6c94a7b5 100644 --- a/tests/e2e/theme.spec.ts +++ b/tests/e2e/theme.spec.ts @@ -1,5 +1,6 @@ import AxeBuilder from "@axe-core/playwright"; import { expect, test } from "../support/browser/strict-browser-test.ts"; +import { WCAG_AXE_TAGS } from "../support/browser/axe-tags.ts"; test("persists an explicit color scheme through the storage contract", async ({ page, @@ -11,7 +12,7 @@ test("persists an explicit color scheme through the storage contract", async ({ await expect(page.locator("html")).toHaveAttribute("data-theme", "dark"); await expect(page.locator("html")).toHaveCSS("color-scheme", "dark"); const results = await new AxeBuilder({ page }) - .withTags(["wcag2a", "wcag2aa", "wcag21a", "wcag21aa"]) + .withTags([...WCAG_AXE_TAGS]) .analyze(); expect( results.violations.filter((violation) => diff --git a/tests/storybook/galleries.spec.ts b/tests/storybook/galleries.spec.ts index 3bbd9f1c..51ffdee2 100644 --- a/tests/storybook/galleries.spec.ts +++ b/tests/storybook/galleries.spec.ts @@ -1,4 +1,5 @@ import AxeBuilder from "@axe-core/playwright"; +import { WCAG_AXE_TAGS } from "../support/browser/axe-tags.ts"; import { expect, @@ -62,7 +63,7 @@ test("opened design-system dialog has no blocking violations", async ({ await page.getByRole("button", { name: "모달 열기" }).click(); const results = await new AxeBuilder({ page }) .include(".ui-dialog") - .withTags(["wcag2a", "wcag2aa", "wcag21a", "wcag21aa"]) + .withTags([...WCAG_AXE_TAGS]) .analyze(); expect( results.violations.filter((violation) => @@ -71,6 +72,31 @@ test("opened design-system dialog has no blocking violations", async ({ ).toEqual([]); }); +// 1112/05-04. The galleries replaced the example screens, whose whole page +// the route scan checked. With no feature installed they are the only place +// the empty, error, sign-in and access surfaces are drawn, so the whole story +// is scanned, in both colour schemes, as the screens were. +for (const story of [ + { id: "platform-galleries--design-system", heading: "UI 구성요소" }, + { id: "platform-galleries--screen-states", heading: "화면 상태" }, +] as const) { + for (const colorScheme of ["light", "dark"] as const) { + test(`${story.id} has no blocking violations in ${colorScheme}`, async ({ page }) => { + await page.emulateMedia({ colorScheme }); + await page.goto(`/iframe.html?id=${story.id}&viewMode=story&globals=a11y.manual:!true`); + await expect(page.getByRole("heading", { level: 1, name: story.heading })).toBeVisible(); + const results = await new AxeBuilder({ page }) + .withTags([...WCAG_AXE_TAGS]) + .analyze(); + expect( + results.violations + .filter((violation) => ["critical", "serious"].includes(violation.impact ?? "")) + .map((violation) => `${violation.id}: ${violation.nodes.map((node) => node.target.join(" ")).join(", ")}`), + ).toEqual([]); + }); + } +} + test("runs menu typeahead, tabs and duplicate toast interactions", async ({ page, }) => { diff --git a/tests/support/browser/axe-tags.ts b/tests/support/browser/axe-tags.ts new file mode 100644 index 00000000..ca9e4ba1 --- /dev/null +++ b/tests/support/browser/axe-tags.ts @@ -0,0 +1,13 @@ +/** + * The WCAG rule tags every axe scan runs. 1112/05-05. The product promises + * WCAG 2.2 AA (PRODUCT.md), so the 2.2 AA rules axe implements (target size, + * 2.5.8) run too. axe has no rule for most 2.2 criteria (focus not obscured, + * dragging alternatives); the manual checklist covers those. + */ +export const WCAG_AXE_TAGS: readonly string[] = Object.freeze([ + "wcag2a", + "wcag2aa", + "wcag21a", + "wcag21aa", + "wcag22aa", +]);