该<input>
属性autocapitalize="words"
在 iOS 8,9 下使用默认 iOS 键盘的移动 Safari 中被破坏。它将字段的前 2 个字母大写,而不是每个单词的第一个字母。
要进行测试,请在 iOS 模拟器或真机上打开以下字段:
First name: <input type="text" autocorrect="off" autocapitalize="words" value="First Name">
您可以使用https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_form_submit进行测试,或者在 iOS 8 或 9 上使用此代码段:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Test autocapitalize</title>
</head>
<body>
<form>
<label for="words">autocapitalize="words"</label>
<input type="text" autocapitalize="words" name="text1" id="words" /><br />
<label for="sentences">autocapitalize="sentences"</label>
<input type="text" autocapitalize="sentences" name="text2" id="sentences" /><br />
<label for="none">autocapitalize="none"</label>
<input type="text" autocapitalize="none" name="text3" id="none" />
</form>
</body>
</html>
我很惊讶这从 8.x 开始就已经存在并且已经被忽视了。
有已知的解决方法吗?
10/13 更新:iPhone 6s+ Safari 完全忽略输入字段上设置的任何 HTML 属性。