emil-touch-and-accessibility
БесплатноБез исполняемых скриптовНе проверенRules for making interfaces work on touch devices and for keyboard and screen-reader users — tap targets, hover vs touch, focus management, aria labels…
от freekmurze★ 1 019 звёзд на GitHubОб этом скилле
Touch & Accessibility
A large share of users will experience your interface through a thumb, a keyboard, or a screen reader — never a mouse. UI that only works with a fine pointer and perfect vision is broken UI, no matter how polished it looks. The rules below are not enhancements to add later; they are the baseline. Hover should enhance, never enable: if functionality is only reachable via hover, it is unreachable on touch.
All CSS below is written as plain CSS for clarity. When implementing, match the project's existing styling system (Tailwind, CSS Modules, styled-components, vanilla-extract, etc.) rather than imposing a new one.
Core Principles
1. Gate hover effects behind capability queries
Touch devices fire :hover on tap, causing stuck or false-positive hover states. Only apply hover styles on devices that actually support hovering:
@media (hover: hover) and (pointer: fine) {
.element:hover {
transform: scale(1.05);
}
}
Never rely on hover for the UI to function — hover reveals and embellishes, it must not be the only way to reach an action.
2. Tap targets are at least 44px
Visual size can stay small; the hit area cannot. Expand it with a pseudo-element:
.icon-button {
/* Visual size can be smaller */
width: 24px;
height: 24px;
position: relative;
}
.icon-button::before {
content: '';
position: absolute;
inset: -10px; /* 24px + 2*10px = 44px hit area */
}
Or with sizing directly:
.small-button {
min-width: 44px;
min-height: 44px;
display: flex;
align-items: center;
justify-content: center;
}
3. Control touch-action
Prevent double-tap zoom on interactive controls:
button, a, input {
touch-action: manipulation;
}
For custom components that implement their own pan/zoom gestures (canvases, sliders, drawing surfaces), disable native gestures entirely so they don't fight yours:
.custom-canvas {
touch-action: none;
}
4. muted + playsinline for autoplaying video
Without both attributes, iOS either refuses to autoplay or opens fullscreen:
<video autoplay muted playsinline loop>
<source src="video.mp4" type="video/mp4" />
</video>
5. Every icon-only button gets an aria-label
<button aria-label="Close dialog">
<CloseIcon />
</button>
<button aria-label="Search">
<SearchIcon />
</button>
Same for illustrations built out of divs/CSS — give them a role and label:
<div
role="img"
aria-label="Abstract geometric pattern"
className="decorative-illustration"
/>
6. Tab order only includes visible elements
Users must never tab into something they can't see. Hide inactive panels from the tab order with visibility: hidden or the inert attribute:
.hidden-panel {
visibility: hidden;
}
<div inert={!isVisible}>...</div>
And keyboard focus must never land off-screen — scroll focused elements into view:
function handleFocus(e) {
e.target.scrollIntoView({
behavior: 'smooth',
block: 'nearest',
});
}
7. Manage focus across modal boundaries
When a modal or dialog opens, move focus into it (first interactive element, or the dialog itself). When it closes, return focus to the element that triggered it. Never leave focus stranded on a removed node.
8. Respect prefers-reduced-motion everywhere
Every animation needs a reduced-motion path. For video, that means offering a play button instead of autoplaying:
const prefersReducedMotion = window.matchMedia(
'(prefers-reduced-motion: reduce)'
).matches;
<video
autoPlay={!prefersReducedMotion}
controls={prefersReducedMotion}
muted
playsinline
/>
9. Freeze time-limited actions when the tab is hidden
A countdown that keeps running in a background tab punishes the user for switching away. Pause on visibilitychange:
let timeoutId;
let remainingTime;
let startTime;
document.addEventListener('visibilitychange', () => {
if (document.hidden) {
// Pause the timer
clearTimeout(timeoutId);
remainingTime -= Date.now() - startTime;
} else {
// Resume the timer
startTime = Date.now();
timeoutId = setTimeout(callback, remainingTime);
}
});
10. Show shortcuts for the user's OS
Display Cmd on macOS, Ctrl elsewhere — and bind the matching key:
const isMac = navigator.platform.toUpperCase().indexOf('MAC') >= 0;
const modKey = isMac ? 'Cmd' : 'Ctrl';
// Display: "Save (Cmd+S)" on Mac, "Save (Ctrl+S)" on Windows
Tooltips & Menus
Delay before opening. Tooltips need a delay so they don't fire on incidental mouse travel:
.tooltip {
transition-delay: 200ms;
}
Warm state for sequential tooltips. Once one tooltip has opened, moving to a neighboring trigger should open its tooltip instantly — no delay, no entrance animation. Track a shared "warm" flag; clear it ~300ms after the last tooltip closes:
const [isWarm, setIsWarm
Установить emil-touch-and-accessibility в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл emil-touch-and-accessibility?
Rules for making interfaces work on touch devices and for keyboard and screen-reader users — tap targets, hover vs touch, focus management, aria labels, reduced motion, iOS Safari quirks. Use when building or reviewing any interactive UI (buttons, modals, tooltips, menus, video, timers) or fixing mobile behavior. Triggers on: touch, mobile, tap target, hit area, hover, hover state, iOS, Safari, iPhone, iPad, keyboard navigation, tab order, tabbing, focus, focus trap, aria, aria-label, accessibility, a11y, screen reader, prefers-reduced-motion, reduced motion, inert, touch-action, double-tap zoom, pinch zoom, playsinline, autoplay video, tooltip delay, submenu, dropdown, dialog, modal, Cmd, Ctrl, keyboard shortcut.
Как установить скилл emil-touch-and-accessibility?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл emil-touch-and-accessibility запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
frontend-design
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making…
от Anthropicwebapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing…
от Anthropicbrand-guidelines
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand…
от Anthropicweb-artifacts-builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use…
от Anthropic