accessibility-auditor

安装量: 56
排名: #13153

安装

npx skills add https://github.com/patricio0312rev/skills --skill accessibility-auditor

Accessibility Auditor

Build inclusive web experiences with WCAG 2.1 compliance and comprehensive a11y patterns.

Core Workflow Audit existing code: Identify accessibility issues Check WCAG compliance: Verify against success criteria Fix semantic HTML: Use proper elements and landmarks Add ARIA attributes: Enhance assistive technology support Implement keyboard nav: Ensure full keyboard accessibility Test with tools: Automated and manual testing Verify with screen readers: Real-world testing WCAG 2.1 Quick Reference Compliance Levels Level Description Requirement A Minimum accessibility Must have AA Standard compliance Industry standard AAA Enhanced accessibility Nice to have Four Principles (POUR) Perceivable: Content must be presentable to all senses Operable: Interface must be navigable by all users Understandable: Content must be clear and predictable Robust: Content must work with assistive technologies Semantic HTML Use Proper Elements

Document Landmarks

<body>

Page Title

Section

...
</body>

Heading Hierarchy

Page Title

Section

<h3>Subsection</h3>
<h3>Subsection</h3>

Section

<h3>Subsection</h3>

ARIA Patterns Buttons // Interactive element that looks like a button

// If you must use a div (avoid if possible)

{ if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); handleClick(); } }} > Click me

Modals / Dialogs // components/Modal.tsx import { useEffect, useRef } from 'react';

interface ModalProps { isOpen: boolean; onClose: () => void; title: string; children: React.ReactNode; }

export function Modal({ isOpen, onClose, title, children }: ModalProps) { const modalRef = useRef(null); const previousActiveElement = useRef(null);

useEffect(() => { if (isOpen) { // Store current focus previousActiveElement.current = document.activeElement; // Focus modal modalRef.current?.focus(); // Prevent body scroll document.body.style.overflow = 'hidden'; } else { // Restore focus (previousActiveElement.current as HTMLElement)?.focus(); document.body.style.overflow = ''; }

return () => {
  document.body.style.overflow = '';
};

}, [isOpen]);

// Handle escape key useEffect(() => { const handleEscape = (e: KeyboardEvent) => { if (e.key === 'Escape' && isOpen) { onClose(); } };

document.addEventListener('keydown', handleEscape);
return () => document.removeEventListener('keydown', handleEscape);

}, [isOpen, onClose]);

if (!isOpen) return null;

return (

{/ Backdrop /}
返回排行榜