Quantcast

Conflict between textarea and contenteditable spell check?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Conflict between textarea and contenteditable spell check?

Douglas Livingstone
I've been having some problems with spellchecking in Firefox when
there is a textarea and a contenteditable div on the same page. Is
there a bugzilla bug for this? Any idea how to fix it?

I have the following test page in Firefox 3.0.9 on WinXP:

<html><body>
<textarea id="t" tabindex='1'>Speeling mistak</textarea>
<div style="border: 1px solid red; height: 120px;" id="c"
contenteditable="true" tabindex='0' >Speeling <b>mistak</b></div>
</body></html>

When I right click on the spelling mistakes in the div, I get a
context menu with suggestions. When right clicking on the spelling
mistakes inside the textarea, I don't get any suggestions, because
InlineSpellCheckerUI.overMisspelling (at least in my xulrunner test
app which has the same behaviour) returns false.

Setting contenteditable to false re-enables suggestions in the
textarea. With that in mind, I have found the following workaround,
(which is used on a page with many textareas and many contenteditable
divs)

<html><body>
<textarea id="t" tabindex='1'>Speeling mistak</textarea>
<div style="border: 1px solid red; height: 120px;" id="c"
contenteditable="true" tabindex='0' >Speeling <b>mistak</b></div>
<script>
var t = document.getElementById("t");
var c = document.getElementById("c");
t.onblur = function() { c.setAttribute("contenteditable", "true");  };
t.onfocus = function() { c.setAttribute("contenteditable",
"false"); };
c.onmousedown = function() { c.setAttribute("contenteditable",
"true");  };
</script>
</body></html>

Some background: I am working on an xulrunner based app, so any patch
which can be applied to xulrunner or my browser.js code would be much
appreciated. This does seems to be a bug in spell check itself.

Cheers,
Douglas
_______________________________________________
dev-tech-editor mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-editor
Loading...