Bug 190776
Summary: | [iOS][WK1] Spelling correction dots do not show unless you focus editable content and then defocus it | ||
---|---|---|---|
Product: | WebKit | Reporter: | Daniel Bates <dbates> |
Component: | WebKit Misc. | Assignee: | Nobody <webkit-unassigned> |
Status: | NEW | ||
Severity: | Normal | CC: | rniwa, webkit-bug-importer, wenson_hsieh |
Priority: | P2 | Keywords: | InRadar, PlatformOnly |
Version: | WebKit Local Build | ||
Hardware: | iPhone / iPad | ||
OS: | iOS 12 | ||
See Also: | https://bugs.webkit.org/show_bug.cgi?id=188762 |
Daniel Bates
Consider a page with the following markup
[[
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width">
<style>
p {
border: 1px solid black;
height: 300px;
width: 200px;
}
</style>
</head>
<body>
<p id="test" contenteditable="true"></p>
<script>
let test = document.getElementById("test");
test.focus();
document.execCommand("InsertText", false, "the the mispelled");
document.execCommand("InsertText", false, " "); // Trigger spelling and grammar checking
</script>
<button>Spell check</button>
</body>
</html>
]]
If you focus the editable field we do not show spelling correction dots. If you type more misspelled words we also do not show spelling correction dots. (Notice that tapping "mispelled" turns it red and shows a callout with suggested replacements. (*)) If you click Done to dismiss the keyboard we do not show spelling correction dots. We only start showing spelling correction dots if you focus the editable field then click "Spell check".
This bug was mentioned in <https://stackoverflow.com/questions/46347640/how-to-make-the-spellcheck-work-on-uiwebview>, <https://stackoverflow.com/questions/49274812/spellcheck-is-not-working-in-uiwebview-ios>, and <https://stackoverflow.com/questions/7927605/how-to-activate-spellchecking-for-a-contenteditable-div-in-a-uiwebview>.
(*) Raised in <https://stackoverflow.com/questions/25440134/spellcheck-for-input-in-uiwebview-is-stopped-working>
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Daniel Bates
Unlike on Mac, we disable continuous spelling checking on iOS in a newly instantiated WebView at <https://github.com/WebKit/webkit/blob/222dd8822aaf985a0a3314297905cb8781605192/Source/WebKitLegacy/mac/WebView/WebView.mm#L5512>. We then use some-kind of heuristic to decide when to trigger spell checking.
Radar WebKit Bug Importer
<rdar://problem/45433889>