跳到正文
Skillpedia
网站与界面(前端)75k · #3060

touch-targets

它能做什么

这项技能检查触屏上的可点击元素是否足够大。适用于希望网站便于触摸操作的设计师和开发者。

适用场景

  • ✓当移动端上关闭、删除等纯图标按钮非常小的时候。
  • ✓当移动端布局中链接或表单控件排得很密的时候。
  • ✓当无障碍审查指出触摸目标小于推荐尺寸的时候。

技能链接

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/touch-targets/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/touch-targets/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“我移动端菜单的关闭按钮很小,不好点按。请帮我检查一下尺寸。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会测量可交互元素(包括其内边距)的大小。它会标记过小的元素,并在不改变外观大小的前提下,建议扩大可点按的区域。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Provide sufficient touch target size

Motor disabilities such as essential tremor, Parkinson's disease, hemiplegia, and spasticity make it difficult to tap small targets with precision. A 24×24px icon button with no padding requires a fine-motor action that many users simply cannot perform. Insufficient tap target size is one of the most common barriers for users with mobility impairments on mobile and tablet devices. Even users without disabilities benefit from larger targets, reducing accidental activations.

Quick Reference

  • WCAG 2.2 SC 2.5.5 (AAA): touch targets must be at least 44×44 CSS pixels
  • WCAG 2.2 SC 2.5.8 (AA, new in WCAG 2.2): targets must be at least 24×24 CSS pixels OR have 24px of spacing from other targets
  • Apple HIG recommends 44×44 pt minimum; Google Material Design recommends 48×48 dp minimum
  • Use padding to enlarge the interactive area without changing the visual size
  • Inline text links are exempt from SC 2.5.8

Check

Find all interactive elements: <button>, <a>, <input>, <select>, <textarea>, and elements with click/touch event handlers or role='button'. For each, compute the rendered bounding box size (including padding). Flag elements whose width or height is less than 24px (WCAG 2.2 AA threshold) or less than 44px (AAA / platform guidelines). Also check spacing: elements smaller than 44px should have at least 24px of clear space from adjacent interactive elements.

Fix

To increase touch target size without changing visual appearance: (1) Add padding to the element — e.g., padding: 12px on a button adds 12px to each side of the visual content. (2) Use min-width and min-height to enforce a floor: min-width: 44px; min-height: 44px. (3) For icon-only buttons, use a transparent pseudo-element to extend the hit area: .icon-btn::before { content: ''; position: absolute; inset: -12px; } with position: relative on the button. (4) Ensure adequate spacing between small targets so users do not accidentally activate the wrong element.

Explain

WCAG 2.2 introduced SC 2.5.8 (Target Size, Minimum) at Level AA, requiring touch targets to be at least 24×24 CSS pixels or have 24px of offset spacing from neighboring targets. The older SC 2.5.5 (Target Size) at Level AAA recommends 44×44px. These thresholds are based on average human fingertip size (approximately 10mm) and the precision required for touchscreen interaction. Users with tremors or limited dexterity need larger targets because their touch point can deviate by 20–30px from where they intend. The 44px recommendation aligns with Apple's Human Interface Guidelines and Google's Material Design system.

Code Review

Review the rendered markup and interactive states that affect Provide sufficient touch target size. Flag exact elements, roles, labels, focus behavior, or keyboard interactions that violate the rule, and note how to verify the fix with browser accessibility tooling or assistive tech.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/accessibility/touch-targets

常见问题

触摸目标应该多大?

这项技能引用 44 x 44 像素作为常用指南,并引用 WCAG 2.2 中的最小值 24 x 24 像素。

能在不改变外观的情况下扩大点按区域吗?

可以。这项技能建议使用内边距扩大可点击区域,而可见尺寸保持不变。

文字链接也需要满足同样的尺寸规则吗?

不需要。这项技能指出,行内文字链接不受最小尺寸规则的约束。

详情

作者的原始描述

Use when applies to all interactive elements on touchscreen interfaces: buttons, links, checkboxes, radio buttons, form inputs, icon buttons, and menu items. Check CSS for min-width, min-height, width, height, and padding on interactive elements. Particularly important for icon-only buttons (close, delete, share) which are often made too small.

repo: thedaviddias/Front-End-Checklist

热度

GitHub 星标
75k
排名
#3060
许可证
MIT
更新时间
2026/10/31

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能