All skills
chromedevtools avatar

/a11y-debugging

@50a16fa

Uses Chrome DevTools MCP for accessibility (a11y) debugging and auditing based on web.dev guidelines. Use when testing semantic HTML, ARIA labels, focus states, keyboard navigation, tap targets, and color contrast.

Use this Skill: https://skilld.dev/gh/chromedevtools/chrome-devtools-mcp/a11y-debugging

This session only. Nothing lands on disk.

referencesa11y-snippets.md

≈697 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Accessibility Debugging Snippets

Use these JavaScript snippets with the evaluate_script tool.

1. Find Orphaned Form Inputs

Finds form inputs that lack an associated label (no label[for], aria-label, aria-labelledby, or wrapping <label>).

() =>
  Array.from(document.querySelectorAll('input, select, textarea'))
    .filter(i => {
      const hasId = i.id && document.querySelector(`label[for="${i.id}"]`);
      const hasAria =
        i.getAttribute('aria-label') || i.getAttribute('aria-labelledby');
      return !hasId && !hasAria && !i.closest('label');
    })
    .map(i => ({
      tag: i.tagName,
      id: i.id,
      name: i.name,
      placeholder: i.placeholder,
    }));

2. Measure Tap Target Size

Returns the bounding box dimensions of an element. Pass the element's uid from the snapshot as an argument to evaluate_script.

el => {
  const rect = el.getBoundingClientRect();
  return {width: rect.width, height: rect.height};
};

3. Check Color Contrast

Approximates the contrast ratio between an element's text color and background color. Pass the element's uid to test against WCAG AA (4.5:1 for normal text, 3:1 for large text).

Note: This uses a simplified algorithm and may not account for transparency, gradients, or background images. For production-grade auditing, consider injecting axe-core.

el => {
  function getRGB(colorStr) {
    const match = colorStr.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);
    return match
      ? [parseInt(match[1]), parseInt(match[2]), parseInt(match[3])]
      : [255, 255, 255];
  }
  function luminance(r, g, b) {
    const a = [r, g, b].map(function (v) {
      v /= 255;
      return v <= 0.03928 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4);
    });
    return a[0] * 0.2126 + a[1] * 0.7152 + a[2] * 0.0722;
  }

  const style = window.getComputedStyle(el);
  const fg = getRGB(style.color);
  let bg = getRGB(style.backgroundColor);

  const l1 = luminance(fg[0], fg[1], fg[2]);
  const l2 = luminance(bg[0], bg[1], bg[2]);
  const ratio = (Math.max(l1, l2) + 0.05) / (Math.min(l1, l2) + 0.05);

  return {
    color: style.color,
    bg: style.backgroundColor,
    contrastRatio: ratio.toFixed(2),
  };
};

4. Global Page Checks

Checks document-level accessibility settings often missed in component testing.

() => ({
  lang:
    document.documentElement.lang ||
    'MISSING - Screen readers need this for pronunciation',
  title: document.title || 'MISSING - Required for context',
  viewport:
    document.querySelector('meta[name="viewport"]')?.content ||
    'MISSING - Check for user-scalable=no (bad practice)',
  reducedMotion: window.matchMedia('(prefers-reduced-motion: reduce)').matches
    ? 'Enabled'
    : 'Disabled',
});

Source: SKILL.md on GitHub

2 warnings16d5 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    The skill provides comprehensive accessibility debugging capabilities using Chrome DevTools to audit web pages. It is considered low risk because it interacts with untrusted external content (browser console logs and accessibility trees), which constitutes a standard surface for indirect prompt injection when paired with the skill's script execution capabilities.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: MEDIUM · 1 issue

  • Runlayer7mo

    1/1 file flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 50a16fa. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 days ago.

Activeupdated last month

README badge

README badge for chromedevtools/chrome-devtools-mcp/a11y-debugging