pekral/cursor-rules/frontend-a11y
Claude Code and agent skill by pekral/cursor-rules
- community
Checking that the SKILL.md file is still in the repository.
Use when building or reviewing accessible UI in a Laravel app — semantic Blade markup, accessible forms, keyboard navigation with Alpine, focus and live-region management for Livewire updates, contrast, and Filament accessibility.
Install
npx vskill@latest install pekral/cursor-rules/frontend-a11ySKILL.md
The same SKILL.md was published earlier as pekral/cursor-rules/frontend-a11y.
Constraints
- Apply
@rules/laravel/livewire.mdc— keep Blade presentation-only; usewire:modelfor bindings; components stay slim. - Apply
@rules/laravel/filament.mdc— reuse Filament's built-in accessible form/action components rather than rebuilding them. - Apply
@rules/security/frontend.md— sanitize any dynamic content before DOM insertion; prefertextContent/setAttributeoverinnerHTML. - Stack is Blade + Livewire + Alpine.js + Filament + Tailwind. No React/Vue/Next — never output
useState/useEffect/useRef/JSX.
Use when
- Building or reviewing forms (
<input>,<select>,<textarea>). - Creating interactive elements (modals, dropdowns, tabs, tooltips) with Alpine.
- Adding
<div>/<span>withwire:clickorx-on:clickinstead of a button. - Adding any
aria-*attribute. - Managing focus or announcing async updates after a Livewire round-trip.
- Acting on accessibility feedback from a review tool.
Form accessibility
Missing for/id pairing and disconnected error messages are the most commonly flagged issues. Livewire's @error directive pairs naturally with aria-describedby.
Label connection
Required fields
Error association with Livewire
@error controls both the aria-invalid/aria-describedby wiring and the message, so the link is always consistent with the validation state. Use fieldset/legend to group related controls (radio sets, address blocks).
Filament forms already emit connected labels, aria-describedby error wiring, and required markers. Reuse Filament form components instead of hand-rolling markup; do not strip their generated attributes.
Semantic HTML
Use the element that matches intent. Screen readers and keyboard users depend on native semantics.
Keep heading levels sequential (h1 → h2 → h3); never skip a level for styling.
ARIA — only when native HTML is insufficient
Wrong ARIA is worse than none.
Expandable trigger:
Keyboard navigation with Alpine
Every interactive element must be reachable and operable by keyboard alone. Build custom widgets with Alpine event modifiers.
Modal / dialog with focus trap
x-trap from the official Alpine Focus plugin handles the trap and restoring focus to the opener. If the plugin is not installed, save document.activeElement on open and call .focus() on it when closing.
Focus & live regions for Livewire updates
A Livewire request swaps DOM fragments; focus and announcements must survive it.
- Loading feedback:
wire:loading/wire:targettoggle visible state without script. - Announce async results with a polite live region so screen readers hear them:
- Urgent errors use
aria-live="assertive"(orrole="alert"), nothing else. - Return focus after a modal closes — dispatch a Livewire/Alpine event and
.focus()the trigger, or rely onx-trap. - Preserve focus across re-render — give moving elements a stable
wire:key; without it Livewire may discard the focused node. - Disable controls during requests with
wire:loading.attr="disabled"so double-submits are blocked accessibly.
Images, icons, contrast, motion
- Contrast: ensure Tailwind text/background token pairs meet WCAG AA (4.5:1 body, 3:1 large). Verify both light and
dark:variants. Never rely on color alone to convey state — pair with text or an icon. - Reduced motion: gate animation with Tailwind's
motion-safe:/motion-reduce:variants instead of always-on transitions.
For Alpine transitions, branch on the media query:
WCAG 2.2 success criteria
WCAG 2.2 added criteria that templated Blade/Livewire UI frequently misses. These complement the patterns above.
Target size — SC 2.5.8 (AA)
Interactive targets must be at least 24×24 CSS px (or have 24px spacing around them). Icon-only buttons and tight table-row actions are the usual offenders.
Focus appearance — SC 2.4.11 (AA)
Every focusable element needs a clearly visible focus indicator. Never strip the outline without replacing it; prefer focus-visible: so the ring shows for keyboard users without firing on mouse click.
Redundant entry — SC 3.3.7 (A)
Within one process (multi-step form, checkout) never ask the user to re-enter information they already provided. Persist it on the Livewire component (or session) and prefill, offering an explicit "same as …" shortcut instead of a blank field.
Dragging movements — SC 2.5.7 (AA)
Any drag-to-reorder/drag-to-move interaction must have a single-pointer alternative (move up/down buttons or a position field), so users who cannot drag can still operate it.
Error suggestions — SC 3.3.3 (AA)
When validation fails and a fix is known, the message must suggest the correction, not just report invalidity. Keep the suggestion generic enough not to leak sensitive data (see @rules/security/backend.md).
Anti-patterns
Checklist
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/frontend-a11y/SKILL.md
Popularity
- Repository stars
- 9
- Repository forks
- 1
- 7-day trend score
- 12
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/pekral/cursor-rules/frontend-a11y)