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

input-types

它能做什么

这项技能审查表单字段,检查它们是否使用了最合适的 HTML input 类型和 autocomplete 设置。适用于构建注册、结账和联系表单的开发者。

适用场景

  • ✓当邮箱或电话字段在手机上显示普通键盘的时候。
  • ✓当浏览器无法自动填充姓名、地址或支付字段的时候。
  • ✓当你构建新表单,并希望它在手机上易于填写的时候。

技能链接

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

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

使用方法

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

可直接粘贴的消息

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

可以这样问 AI

“请检查我的表单字段,并为移动端设置正确的 input 类型。”

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

工作原理

智能体会审查每个 input 元素,并建议 email、tel 和 number 等语义化类型。它还会添加 autocomplete 值,使浏览器能够填入已保存的信息。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Use semantic input type attributes

Using type=text for every input forces mobile users to switch keyboards manually for email, phone, and number entry. The correct type also enables browser autofill to correctly identify fields for name, address, and payment data. Combined with autocomplete attributes, semantic types can make form completion 40% faster for returning users.

Quick Reference

  • type=email shows the @ keyboard on mobile and enables email format validation
  • type=tel shows the numeric phone keypad on mobile
  • type=number shows a numeric keypad; use inputmode=numeric for fields that look like numbers but aren't
  • type=date/time renders native pickers and returns standardized values

Check

Audit all input elements in this HTML file. Check whether each uses the most appropriate type attribute and autocomplete value.

Fix

Update input type attributes to semantic values and add appropriate autocomplete attributes for autofill support.

Explain

Explain the different HTML input types, what each one does on mobile keyboards, and how to combine them with autocomplete attributes.

Code Review

Review templates, server-rendered HTML, and shared components that output markup related to Use semantic input type attributes. Flag exact elements, attributes, and routes where the rendered HTML violates the rule.


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

Rule page: https://frontendchecklist.io/rules/html/input-types

常见问题

在手机上 type email 有什么变化?

这项技能指出,它会显示带有 @ 符号的键盘,并启用邮箱格式检查。

什么时候应使用 inputmode numeric?

这项技能建议用于看起来像数字但并非数字的字段,例如验证码。

它能加快表单填写吗?

这项技能指出,语义化类型配合 autocomplete,可以帮助回访用户更快完成表单。

详情

作者的原始描述

Use when reviewing templates, rendered HTML, or shared components related to Use semantic input type attributes. Validate the final browser-facing markup, not just the source framework abstraction.

repo: thedaviddias/Front-End-Checklist

热度

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

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能