Closed Bug 1058725 Opened 10 years ago Closed 8 years ago

Spellchecker should respect lang attribute of each control (textarea,input, etc)

Categories

(Core :: Spelling checker, defect)

31 Branch
x86_64
Windows 8.1
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla43

People

(Reporter: subscrg, Unassigned)

References

Details

(Whiteboard: DUPEME)

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Firefox/31.0 (Beta/Release)
Build ID: 20140716183446

Steps to reproduce:

With this code even in the latest FF (31.0):

<!DOCTYPE html>
<html lang="fr">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>Textareas with different lang attributes</title>
</head>
<body>
	<form>
		<textarea lang="it" rows="5" cols="40" spellcheck="true">Questa casella di testo contiene del testo in italiano</textarea>
		<br>
		<textarea lang="en" rows="5" cols="40" spellcheck="true">This textarea contains english text</textarea>
		<br>
		<textarea lang="fr" rows="5" cols="40" spellcheck="true">Brie camembert</textarea>
	</form>
</body>
</html>


Actual results:

The three textareas should select respectively the italian, english and french dictionaries, but they didn't do it, and even changing manually the spellchecker dictionary in one of the textareas would make it change in the others.


Expected results:

Each textarea should have selected the correct dictionary based on lang attribute, or on the lang attribute of its containing blocks, up to the html tag lang attribute; choosing a different spellchecker manually should affect only the textarea in which it got selected, or at least the controls that share the same lang of the active textarea, surely not those that have a different lang attribute specified.
Summary: Spellchecker should respect @lang of each control (textarea,input, etc) → Spellchecker should respect lang attribute of each control (textarea,input, etc)
Different people have different requirements here - some of what you suggest conflicts with e.g. bug 728069.
Component: Untriaged → Spelling checker
Product: Firefox → Core
See Also: → 728069
Whiteboard: DUPEME
I don't see any conflict between what I propose and the other bug: the default behaviour should follow lang attributes, then a per site user preference can be added to lock the dictionary to a specific one.

That is how many ad-blocking plugins work: a perfectly reasonable default, with a user selectable override.

In any case, it remains totally weird that FF selects a dictionary totally different from the language explicitly set in code: it would be the same for any language specific setting, such as hyphenation or similar ones, even when it's not applied to user editable elements...
(In reply to Manuele Grueff from comment #2)
> I don't see any conflict between what I propose and the other bug: the
> default behaviour should follow lang attributes, then a per site user
> preference can be added to lock the dictionary to a specific one.
> 
> That is how many ad-blocking plugins work: a perfectly reasonable default,
> with a user selectable override.
> 
> In any case, it remains totally weird that FF selects a dictionary totally
> different from the language explicitly set in code: it would be the same for
> any language specific setting, such as hyphenation or similar ones, even
> when it's not applied to user editable elements...

As I stated in bug 728069 most people predominantly speak one language and use that language no matter what the language of the site is. It makes no difference if I'm on a French, Italian or Russian site I'm always going to be posting in English.
I don't think this is a correct assumption: it might be true that if an input box does not explicitly set the lang attribute, that could mean that the user is free to write in whatever language he wants (not necessarily in the page's language), but when instead the web site explicitly sets the lang attribute I think this does mean that the web site is telling the user that input field SHOULD be filled with that language, and that everything he writes in that input would be treated as that language.

Maybe a correct compromise could be that, as I said, an input should choose the lang based on its attribute and then the info on the page, and the user should have a per site and/or global override so that he can lock the dictionary to whatever he's pleased with.

In this way, multi lingual forms such as translation ones would work ok, while the user would retain the ability to tailor the web browser as he pleases.

In any case I'm still convinced that if a textarea has an explicit lang attribute, this means that it should be filled with that language, and so the automatically chosen dictionary should be that language one.
Also, Stewart has a very British centric approach: he can have that approach since one of the most used languages is his own!

I'm an Italian, and albeit I fluently speak both English and French, I would surely prefer to write these posts in MY language instead that in English, but... This would not be useful at all!

This is to say that I don't think that discussion on language related functions should be done by starting from the needs of English speaking people, who very rarely happen to use any other language besides their own.

Instead, I think that, for example, many non native English speaking people would surely benefit of having the help of the correct dictionary when writing in a language that is not their own, be it English or French or whatsoever.

Also, I don't see nothing bad in making textareas be aware of their lang attribute: since nowadays the lang attribute is rarely present in tetxareas, doing that would not break the current spellchecker behaviour.
We are developing a business application where the user has a text area with her native language to the left and a text area with e.g. the english translation to the right. We have multiple "rows" of these pairs of textareas - it would be extremely useful to be able to specify spellchecking languages for each textarea. I'm happy to provide more details or examples if that can help convince more people that this would be a useful feature.
Yes, it's a very old issue that usually generate a whole lot amount of talk, and little to no action. This behavior was reported, what was it, 8, 9 years ago?

Still, here we go again: there is absolutely no reason why Firefox should not follow the XML/HTML guidelines established by a web page, including here the language attribute, unless explicitly overridden by the user.

In this (very good) example above, each textarea should “load” the proper dictionary as stated by its attribute.

Is no lang attribute is set, use the parent one, and if there still is no lang attribute, use the parent's parent one and so on.

<html lang="it">
…
<textarea>
The textarea is in Italian.


<html lang="it">
…
<div lang="fr">
<div>
<textarea>
The textarea is in French.

<html lang="it">
…
<div lang="fr">
<div lang="en">
<textarea>
The textarea is in English.

This behavior is a natural first step, completely logical.

Then later on when this is fixed people can add an Option or write an Extension to alter this for their own specific needs, but this general behavior is still natural and expected and the most easily understood by anyone, geek or general public.
There are definitely mixed-language applications out there. Think of research subsidies applications where abstracts have to be submitted in both international English and a local language. So, IMO, Firefox should support this.

Indeed, Firefox does support this: https://bugzilla.mozilla.org/show_bug.cgi?id=338427

But the interface is somewhat confusing. I did a similar test: With all dictionaries installed, Firefox applies the correct language-specific spelling in every field *while the cursor is in that field*. When the cursor changes to the next field, Firefox correctly switches the spelling language to that field's language, but not only for the focussed field, but for the other fields as well, changing the red underlines there. 

So we do have the correct spelling while typing in a field, but we see the correct spelling marks only for the focussed field.

Tested on: Firefox 34.0 on OS X 10.9.5
I can see the same behaviour as Jay mentioned in comment 8. Is this bug report still relevant?
Flags: needinfo?(subscrg)
I still see the bug as relevant. Even in the latest version Firefox doesn't properly react to lang attributes in textareas, and still doesn't select the correct spellcheck dictionary, even if loading the page for the first time in an empty new profile, to which only the relevant dictionaries have been added.
This page shows the wrong behaviour of the bug: lang attributes on textareas do not get respected by dictionaries.
Flags: needinfo?(subscrg)
Spellchecking was reworked in bug 1200533, bug 717433, bug 697981, bug 1205983, bug 1204147 and bug 1193293.

The spellchecker honours the lang attributes of text areas, unless a content preference sets a common language for the whole page. See meta-bug 1073827 comment #33 for details. The safest way to remove the content preference is to remove/rename the content-prefs.sqlite from the profile or test with a new profile.

The problem reported here is fixed in Firefox 43, some of the bugs mentioned here landed on Firefox 44.
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla43

(In reply to Jérémie Bouillon from comment #7)

Yes, it's a very old issue that usually generate a whole lot amount of talk,
and little to no action. This behavior was reported, what was it, 8, 9 years
ago?

Still, here we go again: there is absolutely no reason why Firefox should
not follow the XML/HTML guidelines established by a web page, including here
the language attribute, unless explicitly overridden by the user.

In this (very good) example above, each textarea should “load” the proper
dictionary as stated by its attribute.

Is no lang attribute is set, use the parent one, and if there still is no
lang attribute, use the parent's parent one and so on.

<html lang="it">

<textarea>
The textarea is in Italian.

<html lang="it">

<div lang="fr">
<div>
<textarea>
The textarea is in French.

<html lang="it">

<div lang="fr">
<div lang="en">
<textarea>
The textarea is in English.

This behavior is a natural first step, completely logical.

Then later on when this is fixed people can add an Option or write an
Extension to alter this for their own specific needs, but this general
behavior is still natural and expected and the most easily understood by
anyone, geek or general public.

Now on FF v74.0, has this been implemented?

thank you for the link to that test page, but I still need to select the Language. It is not auto selected when clicking on the field. This illustrates what I see: https://www.filmfix.com/images/lang.jpg

I don't understand the comment. In the example, you have three text areas, English, Spanish, French, and clicking into the text areas, the dictionary switches to that language. Of course you need to have the dictionaries installed.

The same is true for the three contenteditable fields below, sadly there all three fields are re-checked on the language that is chosen upon click, that's bug 1209220.

I think you have a content preference set for the language on that page, which then overrides the individual languages. I've just selected German for https://bug697981.bmoattachments.org/attachment.cgi?id=8660290 and now the entire page is "messed up" and everything is checked in German and the individual language is lost. Open the page on a new FF profile and you will see it working.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: