mcpField
F
framework-accessibility

framework-accessibility

github.com/community-accessDevelopment429250 installsUpdated today
Repository

About framework-accessibility

A reference skill for accessibility patterns in React, Next.js, Vue, Angular, Svelte, and Tailwind CSS. It helps frontend developers identify common framework-specific issues and apply code-level fixes for keyboard access, focus, dynamic content, and contrast.

Key features

  1. 01Organize common issues by framework
  2. 02Provide code fix templates
  3. 03Address keyboard access and focus management
  4. 04List contrast-safe Tailwind CSS pairs

Use cases

  1. 01Review accessibility in frontend components
  2. 02Fix framework-specific focus problems
  3. 03Check color contrast in Tailwind interfaces

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/community-access/accessibility-agents --skill framework-accessibility

After installing, type/framework-accessibilityin Claude Code to confirm it loaded.

Details

From the project README

Framework-Specific Accessibility Patterns

React / Next.js

Common Pitfalls
PatternIssueFix
onClick on <div>Not keyboard accessibleUse <button> or add role="button", tabIndex={0}, onKeyDown
dangerouslySetInnerHTMLMay inject inaccessible contentAudit injected HTML for ARIA, headings, alt text
React.Fragment as rootMay break landmark treeEnsure fragments don't interrupt landmark nesting
Missing key on listsCan cause focus loss on re-renderUse stable keys (not array index) for interactive lists
Portal without focus trapFocus can escape to backgroundWrap portal content in FocusTrap component
useEffect focus managementFocus may not fire on mountUse useRef + useEffect with proper dependency array
Fix Templates
// Bad: div as button
<div onClick={handleClick}>Submit</div>

// Good: semantic button
<button onClick={handleClick}>Submit</button>

// Bad: image without alt in Next.js
<Image src="/hero.jpg" width={800} height={400} />

// Good: image with alt
<Image src="/hero.jpg" width={800} height={400} alt="Team collaborating in a modern office" />

// Bad: no focus management on route change
useEffect(() => {
  // nothing
}, [location]);

// Good: focus management on route change
useEffect(() => {
  const mainContent = document.getElementById('main-content');
  if (mainContent) {
    mainContent.focus();
    mainContent.scrollIntoView();
  }
}, [location]);

// Bad: link opening new tab
<a href={url} target="_blank">Resource</a>

// Good: link with new tab warning
<a href={url} target="_blank" rel="noopener noreferrer">
  Resource <span className="sr-only">(opens in new tab)</span>
</a>

Vue

Common Pitfalls
PatternIssueFix
v-html with user contentMay inject inaccessible markupSanitize and audit injected HTML
v-if on live regionsRemoves element from DOM, breaks announcementsUse v-show for live regions instead
<transition> without focusFocus lost when content transitionsManage focus in @after-enter hook
<teleport> to bodyContent outside app landmark treeAdd landmark roles to teleported content
Fix Templates
<!-- Bad: v-if on live region -->
<div v-if="message" aria-live="polite">{{ message }}</div>

<!-- Good: v-show keeps element in DOM -->
<div v-show="message" aria-live="polite">{{ message }}</div>

<!-- Bad: no focus after transition -->
<transition name="fade">
  <div v-if="showModal" class="modal">...</div>
</transition>

<!-- Good: focus managed after transition -->
<transition name="fade" @after-enter="focusModal">
  <div v-if="showModal" ref="modal" class="modal" tabindex="-1">...</div>
</transition>

Angular

Common Pitfalls
PatternIssueFix
[aria-label] bindingInvalid - ARIA is not a propertyUse [attr.aria-label]
*ngFor without trackByFocus loss on list re-renderAdd trackBy function
No LiveAnnouncerRoute changes not announcedInject LiveAnnouncer and announce navigation
OnPush + live regionsChange detection may not triggerUse ChangeDetectorRef.markForCheck()
Fix Templates
// Bad: ARIA binding
<button [aria-label]="label">X</button>

// Good: ARIA attribute binding
<button [attr.aria-label]="label">X</button>

// Bad: ngFor without trackBy
<li *ngFor="let item of items">{{ item.name }}</li>

// Good: ngFor with trackBy
<li *ngFor="let item of items; trackBy: trackById">{{ item.name }}</li>

// Route change announcements
constructor(private liveAnnouncer: LiveAnnouncer, private router: Router) {
  this.router.events.pipe(
    filter(event => event instanceof NavigationEnd)
  ).subscribe((event: NavigationEnd) => {
    this.liveAnnouncer.announce(`Navigated to ${this.getPageTitle()}`);
  });
}

Svelte

Common Pitfalls
PatternIssueFix
{#if} without focus managementFocus lost when content appearsUse use:action to focus new content
transition: without motion checkAnimations play regardless of user preferenceAdd prefers-reduced-motion check
on:click on non-interactiveNot keyboard accessibleUse <button> or add keyboard handlers
Fix Templates
<!-- Bad: click on div -->
<div on:click={toggle}>Toggle</div>

<!-- Good: keyboard accessible -->
<button on:click={toggle}>Toggle</button>

<!-- Bad: animation without motion preference -->
<div transition:fly={{ y: 200 }}>Content</div>

<!-- Good: respects motion preference -->
<div transition:fly={{ y: reducedMotion ? 0 : 200, duration: reducedMotion ? 0 : 300 }}>Content</div>

<script>
  const reducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
</script>

Tailwind CSS

Common Pitfalls
PatternIssueFix
outline-noneRemoves focus indicatorPair with ring-2 ring-offset-2 focus-visible:ring-blue-500
text-gray-400 on bg-whiteFails 4.5:1 contrastUse text-gray-600 or darker
No motion-reduce: variantAnimations ignore user preferenceAdd motion-reduce:transition-none
Missing focus: stylesNo visible focus indicatorAdd focus:ring-2 focus:ring-blue-500
sr-only missingScreen reader text not availableAdd <span class="sr-only">description</span>
Contrast-Safe Tailwind Pairs
BackgroundMinimum TextRatio
bg-whitetext-gray-6004.55:1
bg-whitetext-gray-7006.62:1
bg-gray-50text-gray-7006.29:1
bg-gray-900text-gray-3005.92:1
bg-blue-600text-white5.23:1
bg-red-600text-white4.54:1
bg-green-700text-white4.58:1
Fix Templates
<!-- Bad: no focus indicator -->
<button class="bg-blue-500 text-white px-4 py-2 rounded outline-none">
  Submit
</button>

<!-- Good: visible focus indicator -->
<button class="bg-blue-500 text-white px-4 py-2 rounded focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2">
  Submit
</button>

<!-- Bad: low contrast -->
<p class="text-gray-400">Important information</p>

<!-- Good: adequate contrast -->
<p class="text-gray-700">Important information</p>

<!-- Bad: animation without motion preference -->
<div class="transition-transform duration-300 hover:scale-105">Card</div>

<!-- Good: respects motion preference -->
<div class="transition-transform duration-300 hover:scale-105 motion-reduce:transition-none motion-reduce:hover:scale-100">Card</div>

Comments

Markdown supported