禁用 Mac OS X Lion Safari 对 contentEditable div 的自动更正功能?

发布于 2024-12-16 14:16:39 字数 725 浏览 4 评论 0原文

我们有一个具有大量 contentEditable

的 Web 应用程序。由于 Mac OS X Lion 上 Safari 中的主动自动更正功能,我们在 Safari 尝试为用户自动更正时遇到了许多问题。

我已经能够通过手动转到“编辑>拼写和语法”并禁用“自动正确拼写”选项来阻止这种情况发生。然而,我想知道是否有一种方法可以通过编程方式执行此操作,无论是在 javascript 中还是使用 html 属性。来自 Apple 的文档 (https://developer. apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/DesigningForms/DesigningForms.html),有一个html 表单字段上的“自动更正”属性,让网站设计者决定是否应启用自动更正。

此“自动更正”属性仅适用于移动 Safari 吗?它适用于 contentEditable div 吗?如果没有,是否还有其他选择,只是告诉用户手动关闭自动更正?

We have a web application that has a large number of contentEditable <div>'s. With the aggressive autocorrect in Safari on Mac OS X Lion, we have had a number of problems with Safari attempting to autocorrect for our users.

I have been able to stop this from happening by manually going to 'Edit>Spelling and Grammar' and disabling the 'Correct Spelling Automatically' option. I'm wondering, however, if there is a way to do this programmatically, either in javascript or using html attributes. From Apple's documentation (https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/DesigningForms/DesigningForms.html), there is an 'autocorrect' attribute on html form fields that let the site designer decide if autocorrect should be on or not.

Is this 'autocorrect' attribute only on mobile safari? Does it work on contentEditable divs? If not, is there an alternative other that just telling the users to go and turn off autocorrect manually?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

勿忘初心 2024-12-23 14:16:39

您可以使用 spellcheck 属性来启用或禁用拼写检查(可能的值为 truefalse)。

您可以在以下位置找到有关此属性的更多详细信息: HTML5 规范

You can use the spellcheck attribute to enable or disable spell checking (possible values are true and false)

You can find more details about this attribute in the HTML5 spec.

深陷 2024-12-23 14:16:39

iOS Safari 中关闭自动更正/自动完成功能的实现目前尚未完成。对于普通的 input 字段,auto Correct 属性可用于关闭自动完成:

<input type="text" name="feild1" autocorrect="off">

但该属性对于带有 div 没有任何作用>contenteditable 设置,也不适用于其中的标签。两者:

<div contenteditable="true" autocorrect="off"><p>Edit me!</p></div>

并且:

<div contenteditable="true"><p autocorrect="off">Edit me!</p></div>

仍然允许自动更正和自动完成。 Apple 只允许将 auto Correct 属性和关闭自动更正/完成功能的相关功能应用于传统表单字段。

恐怕我无法找到也适用于 contentEditable div 字段的替代解决方案。我是否可以建议在 Apple 的错误报告器 bugreport.apple.com 上提出该问题?这是一个足够明确的请求,只要他们被告知,它可能很快就会得到修复。

The implementation of the ability to turn off auto-correct/auto-complete in iOS Safari is currently incomplete. For normal input fields, the autocorrect attribute can be used to turn off auto-completion:

<input type="text" name="feild1" autocorrect="off">

But that attribute does nothing for a div with contenteditable set, nor for a tag therein. Both:

<div contenteditable="true" autocorrect="off"><p>Edit me!</p></div>

And:

<div contenteditable="true"><p autocorrect="off">Edit me!</p></div>

Still allow auto-correct and auto-complete. Apple has only allowed the autocorrect attribute and associated ability to turn off auto-correction/completion to apply to traditional form fields.

I'm afraid that I wasn't able to find an alternate solution which would also apply to contentEditable div fields. May I suggest raising the issue on Apple's bug reporter, bugreport.apple.com? This is a clear-cut enough request, that it just might get fixed before too long, provided they're informed about it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文