Conflict between textarea and contenteditable spell check?

Douglas <[email protected]>
Newsgroups gmane.comp.mozilla.devel.editor
Organization http://groups.google.com
Message-ID <bec9077d-0e8c-48bf-a935-46dbb7bd9670@r37g2000yqn.googlegroups.com>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.