accessibility-fix
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseThis skill remediates accessibility violations: baseline, edit, verify. It only fixes. To find what's wrong, use (one page, automated), (one page, manual), or (whole site, WCAG-EM); to check for regressions, use . The engine runs here are internal to the loop — a baseline before and a check after — not a report.
accesslint:accessibility-scanaccesslint:accessibility-inspectaccesslint:accessibility-auditaccesslint:accessibility-diffShared conventions (grounding, never invent content): .
../shared/methodology.mdFor large remediations, run via for context isolation; the steps are the same.
Task本技能用于整改无障碍违规问题:流程为基准检测、编辑、验证。它仅负责修复问题。如需排查问题,请使用(单页面、自动化)、(单页面、手动)或(全站点、WCAG-EM标准);如需检查回归问题,请使用。流程内部运行的引擎仅用于前后基准检测,不生成报告。
accesslint:accessibility-scanaccesslint:accessibility-inspectaccesslint:accessibility-auditaccesslint:accessibility-diff通用规范(基于既定内容,绝不自行编造):。
../shared/methodology.md针对大规模整改任务,请通过运行以实现上下文隔离,操作步骤保持不变。
TaskInput
输入
- A findings worklist (from ,
accessibility-scan, oraccessibility-inspect, or pasted): apply it directly; the baseline is already done.accessibility-audit - A target (URL, config target name, files, or a directory): audit it first for the baseline, then fix.
Given neither, ask what to fix. Don't sweep a whole codebase unprompted.
- 问题清单(来自、
accessibility-scan、accessibility-inspect,或直接粘贴):直接应用该清单,基准检测已完成。accessibility-audit - 目标对象(URL、配置目标名称、文件或目录):先执行基准检测,再进行修复。
若未提供以上任一输入,请询问需要修复的内容。切勿未经提示就扫描整个代码库。
Picking a flow (for baseline and verify)
选择流程(用于基准检测和验证)
- for any URL. It ensures a debuggable Chrome (auto-launches a headless one if none is reachable) and audits the live DOM. Use
audit_liveto scope andselectorfor async content. The live DOM catches what source can't.wait_for - for raw HTML strings, files (
audit_htmlfirst), or JSX rendered to a string.Read
For an authenticated session, have the user start a headed debuggable Chrome (), sign in, then call to attach to it.
npx @accesslint/chrome ensure --headedaudit_live({ url, port })- :适用于任意URL。它会确保使用可调试的Chrome浏览器(如果无法连接到现有浏览器,将自动启动无头浏览器)并对实时DOM进行检测。使用
audit_live限定范围,使用selector处理异步内容。实时DOM能捕获源代码无法检测到的问题。wait_for - :适用于原始HTML字符串、文件(需先执行
audit_html操作)或渲染为字符串的JSX。Read
如需处理已认证会话,请让用户启动带界面的可调试Chrome浏览器(),完成登录后,调用连接到该浏览器。
npx @accesslint/chrome ensure --headedaudit_live({ url, port })Steps
步骤
- Baseline. Audit with and record the violation set (rule ID and selector for each). Skip this if you were handed a worklist.
format: "compact" - Apply. For each violation:
- If a line is present, open that file at that line. If several are listed (separated by
Source:), the first is the JSX literal and the rest are enclosing components; use←to disambiguate.Symbol - If not, grep stable hooks (,
data-testid,id), then visible text, then tree position.aria-label - Use the and
Fixability:fields: applyFix:fixes as given; leave amechanicalwith the rule ID forTODOorcontextual. Don't invent content (alt text, labels, link text).visual - Group edits to the same file into one operation.
- Confirm scope before editing files outside the obvious target, or before more than about 10 mechanical fixes.
- If a
- Verify. Re-run the same audit and compare to the baseline: every targeted violation gone, no new ones. For a precise new/fixed/pre-existing comparison on a URL, use rather than checking by eye.
accesslint:accessibility-diff
Source:explain_rule({ id })- 基准检测:使用格式执行检测,记录违规集合(每条违规的规则ID和选择器)。若已提供问题清单,则跳过此步骤。
format: "compact" - 应用修复:针对每条违规:
- 若存在行,打开对应文件并定位到该行。若列出了多个文件(用
Source:分隔),第一个是JSX字面量文件,其余为嵌套组件文件;使用←进行区分。Symbol - 若不存在行,先搜索稳定钩子(
Source:、data-testid、id),再搜索可见文本,最后依据树状结构定位。aria-label - 根据和
Fixability:字段:按要求应用Fix:(机械性)修复;对于mechanical(上下文相关)或contextual(视觉相关)问题,留下带有规则ID的visual标记。不得自行编造内容(如替代文本、标签、链接文本)。TODO - 将对同一文件的编辑操作合并为一次执行。
- 在编辑明显目标范围外的文件,或执行超过约10项机械性修复前,请确认操作范围。
- 若存在
- 验证:重新执行相同的检测并与基准结果对比:确保所有目标违规已修复,且未出现新的违规。如需对URL进行精准的新增/已修复/原有问题对比,请使用,而非人工检查。
accesslint:accessibility-diff
Source:explain_rule({ id })When to stop
停止条件
- A violation with no directive: leave a
Fix:, don't guess.TODO - Verification fails (a new violation appeared, or a targeted one remains): report it and stop. Don't iterate silently.
- 若违规条目无指令:留下
Fix:标记,切勿猜测。TODO - 验证失败(出现新违规,或目标违规仍未修复):报告问题并停止操作。不得静默重复尝试。
Output
输出
Per cycle: the flow used, violations by impact, what was applied (file and rule), what was deferred (TODOs and why), and the before and after counts.
每个循环周期的输出内容包括:使用的流程、按影响程度分类的违规、已应用的修复(文件和规则)、已推迟的任务(TODO及原因),以及修复前后的违规数量统计。