Open Bug 1209220 Opened 9 years ago Updated 1 year ago

Don't spell multiple contenteditables with different @lang with the same dictionary (the one of the element that was clicked last)

Categories

(Core :: Spelling checker, defect)

defect

Tracking

()

People

(Reporter: ehsan.akhgari, Unassigned)

References

(Blocks 1 open bug)

Details

It seems like bug 338427 either didn't fix things for contenteditable or it has regressed in some point.  In bug 1205983, Jorg told me that it no longer works.  I haven't investigated what causes the issue.
There is a misunderstanding here.

Contenteditables like textareas and other input elements derive the language from the "lang" attribute.

So on a page like attachment 8660290 [details] with this content:
<div contenteditable="" lang="en">
Thiss is an English text full of English words for the spell checker</div>
<div contenteditable="" lang="es">
Aquí unn texto en español lleno de palabras españolas para la prueba de ortografía</div>
<div contenteditable="" lang="fr">
Ici unn texte en français avec beaucoup de mots en français</div>

*of course* clicking on the individual <div> elements *does* spell in the desired language (assuming the appropriate dictionaries are installed).

Since all three <div>s share the same editor, clicking on the Spanish <div> spells *all* three <div>s in Spanish. Clicking then on the English <div>, spells all <div>s in English.

To my knowledge that has always been that way. An (un)educated guess is:
It may have to do with the
mozInlineSpellChecker.cpp: SpellCheckRange(nullptr); where we blindly recheck all ranges.
(I'm not sure what "all ranges" encompasses, maybe various ranges in the same editor but in different <div>s - correct me, if I'm wrong.)
(In reply to Jorg K (GMT+2) from comment #1)
> To my knowledge that has always been that way. An (un)educated guess is:
> It may have to do with the
> mozInlineSpellChecker.cpp: SpellCheckRange(nullptr); where we blindly
> recheck all ranges.

Yeah we need to stop doing that.

> (I'm not sure what "all ranges" encompasses, maybe various ranges in the
> same editor but in different <div>s - correct me, if I'm wrong.)

Doing this "properly" is very difficult as the whole code assumes each editor has one spell checker which has one language.  We may be able to get away with a hack based on ignoring the ranges that don't match our current language but that seems hard to get right.
OS: Unspecified → All
Hardware: Unspecified → All
Summary: Use @lang for contenteditable → Don't spell multiple contenteditables with different @lang with the same dictionary (the one of the element that was clicked last)
Version: unspecified → Trunk
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.