accessibility-fix

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
This skill remediates accessibility violations: baseline, edit, verify. It only fixes. To find what's wrong, use
accesslint:accessibility-scan
(one page, automated),
accesslint:accessibility-inspect
(one page, manual), or
accesslint:accessibility-audit
(whole site, WCAG-EM); to check for regressions, use
accesslint:accessibility-diff
. The engine runs here are internal to the loop — a baseline before and a check after — not a report.
Shared conventions (grounding, never invent content):
../shared/methodology.md
.
For large remediations, run via
Task
for context isolation; the steps are the same.
本技能用于整改无障碍违规问题:流程为基准检测、编辑、验证。它仅负责修复问题。如需排查问题,请使用
accesslint:accessibility-scan
(单页面、自动化)、
accesslint:accessibility-inspect
(单页面、手动)或
accesslint:accessibility-audit
(全站点、WCAG-EM标准);如需检查回归问题,请使用
accesslint:accessibility-diff
。流程内部运行的引擎仅用于前后基准检测,不生成报告。
通用规范(基于既定内容,绝不自行编造):
../shared/methodology.md
针对大规模整改任务,请通过
Task
运行以实现上下文隔离,操作步骤保持不变。

Input

输入

  • A findings worklist (from
    accessibility-scan
    ,
    accessibility-inspect
    , or
    accessibility-audit
    , or pasted): apply it directly; the baseline is already done.
  • 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)

选择流程(用于基准检测和验证)

  1. audit_live
    for any URL. It ensures a debuggable Chrome (auto-launches a headless one if none is reachable) and audits the live DOM. Use
    selector
    to scope and
    wait_for
    for async content. The live DOM catches what source can't.
  2. audit_html
    for raw HTML strings, files (
    Read
    first), or JSX rendered to a string.
For an authenticated session, have the user start a headed debuggable Chrome (
npx @accesslint/chrome ensure --headed
), sign in, then call
audit_live({ url, port })
to attach to it.
  1. audit_live
    :适用于任意URL。它会确保使用可调试的Chrome浏览器(如果无法连接到现有浏览器,将自动启动无头浏览器)并对实时DOM进行检测。使用
    selector
    限定范围,使用
    wait_for
    处理异步内容。实时DOM能捕获源代码无法检测到的问题。
  2. audit_html
    :适用于原始HTML字符串、文件(需先执行
    Read
    操作)或渲染为字符串的JSX。
如需处理已认证会话,请让用户启动带界面的可调试Chrome浏览器(
npx @accesslint/chrome ensure --headed
),完成登录后,调用
audit_live({ url, port })
连接到该浏览器。

Steps

步骤

  1. Baseline. Audit with
    format: "compact"
    and record the violation set (rule ID and selector for each). Skip this if you were handed a worklist.
  2. Apply. For each violation:
    • If a
      Source:
      line is present, open that file at that line. If several are listed (separated by
      ), the first is the JSX literal and the rest are enclosing components; use
      Symbol
      to disambiguate.
    • If not, grep stable hooks (
      data-testid
      ,
      id
      ,
      aria-label
      ), then visible text, then tree position.
    • Use the
      Fixability:
      and
      Fix:
      fields: apply
      mechanical
      fixes as given; leave a
      TODO
      with the rule ID for
      contextual
      or
      visual
      . Don't invent content (alt text, labels, link text).
    • 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.
  3. 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
    accesslint:accessibility-diff
    rather than checking by eye.
Source:
lines come from React DevTools fibers and appear only in live-DOM audits against React dev builds. Static audits won't have them; fall back to selectors. When unsure about a rule, use
explain_rule({ id })
.
  1. 基准检测:使用
    format: "compact"
    格式执行检测,记录违规集合(每条违规的规则ID和选择器)。若已提供问题清单,则跳过此步骤。
  2. 应用修复:针对每条违规:
    • 若存在
      Source:
      行,打开对应文件并定位到该行。若列出了多个文件(用
      分隔),第一个是JSX字面量文件,其余为嵌套组件文件;使用
      Symbol
      进行区分。
    • 若不存在
      Source:
      行,先搜索稳定钩子(
      data-testid
      id
      aria-label
      ),再搜索可见文本,最后依据树状结构定位。
    • 根据
      Fixability:
      Fix:
      字段:按要求应用
      mechanical
      (机械性)修复;对于
      contextual
      (上下文相关)或
      visual
      (视觉相关)问题,留下带有规则ID的
      TODO
      标记。不得自行编造内容(如替代文本、标签、链接文本)。
    • 将对同一文件的编辑操作合并为一次执行。
    • 在编辑明显目标范围外的文件,或执行超过约10项机械性修复前,请确认操作范围。
  3. 验证:重新执行相同的检测并与基准结果对比:确保所有目标违规已修复,且未出现新的违规。如需对URL进行精准的新增/已修复/原有问题对比,请使用
    accesslint:accessibility-diff
    ,而非人工检查。
Source:
行来自React DevTools fibers,仅在针对React开发构建的实时DOM检测中显示。静态检测不会生成该内容;此时请 fallback 到选择器定位。若对某条规则存疑,请使用
explain_rule({ id })

When to stop

停止条件

  • A violation with no
    Fix:
    directive: leave a
    TODO
    , don't guess.
  • 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及原因),以及修复前后的违规数量统计。