编写可测试的无障碍验收标准
针对用户故事中的组件与状态制定无障碍验收条目,关联规范编号、测试方式和待决问题。
完整提示词
<context>
Most accessibility bugs are designed in or built in, then found in an audit months later, when they cost ten times more to fix. Teams that write accessibility acceptance criteria on the ticket catch them before merge. Bad criteria fail in two ways: "Must be accessible" or "Meets WCAG 2.2 AA" (untestable; nobody knows what to check), and a pasted list of all 55 success criteria on every ticket (noise; ignored by the second sprint). Good criteria are specific to the components in this story, written as observable behaviour a tester can pass or fail with a keyboard, a screen reader and browser zoom, and each traces to a success criterion.
</context>
<task>
Write accessibility acceptance criteria for this story at WCAG 2.2 level {{wcag_level}}:
<story>
{{story}}
</story>
1. List the components and states in the story: each control, form field, dynamic region, dialog, image, media and message, and the states it passes through (empty, loading, error, success, disabled).
2. For each component, write only the criteria that apply, as Given/When/Then or short "Then" statements a tester can verify. Cover the relevant areas:
- Keyboard: reachable, operable with the expected keys, logical order, no trap, visible focus, where focus goes after the action.
- Name, role, state: what a screen reader announces, written as the expected announcement ("Announced as 'Delivery date, edit text, required'").
- Announcements: what is announced on async changes, errors and success, and with what politeness.
- Visual: text contrast 4.5:1, non-text contrast 3:1, no meaning by colour alone, target size at least 24 by 24 CSS px, reflow at 320 px and 400% zoom, text spacing.
- Motion and time: reduced-motion behaviour, no time limits or adjustable ones.
- Forms: visible labels, instructions, error identification and suggestion, no redundant entry, accessible authentication if a login or code is involved.
- Content: alt text required for which images, captions or transcript for which media, headings and page title.
- If the level is AAA, add the AAA criteria that apply (for example 7:1 contrast, 44 by 44 px targets, no timing, re-authentication without data loss).
3. Give every criterion an id (AC-1, AC-2), the WCAG success criterion number, and how to test it (keyboard, screen reader, zoom, contrast tool, automated).
4. Mark which criteria an automated test can enforce and which need a manual check.
5. List what the story does not specify but must decide (for example the error message wording or where focus lands after saving) as questions, not assumptions.
</task>
<constraints>
- Write criteria only for components in the story. No generic WCAG checklist.
- Each criterion is pass or fail by observation; no "should be easy to use".
- Do not invent product behaviour the story does not describe; ask in Questions.
- At most 25 criteria; if the story needs more, say it should be split.
{{> guardrails/scope-discipline}}
</constraints>
<output_format>
## Components found
Bullets: component and its states.
## Acceptance criteria
Grouped by component. Table per component: ID | Criterion | WCAG SC | How to test | Automatable (yes or no).
## Out of scope
One line each: related checks that belong to other tickets (for example site-wide header).
## Questions
Numbered decisions the product owner or designer must make.
</output_format>可替换内容
- {{wcag_level}}
- {{story}}
- {{> guardrails/scope-discipline}}
分类与标签
编程开发、无障碍验收、用户故事、键盘测试、屏幕阅读器、自动化测试