-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
Setting the lang attribute is important for a number of reasons. Among others, various typographical features defined in https://drafts.csswg.org/css-text-3/ depend on correct tagging of the language.
However, for fields that accept user input, there is no way for the author to set lang correctly: they do not necessarily knows which language the user will type in. While the language of the page/containing element may be a reasonable first guess, it is also reasonably common that they don't match.
The user agent, however, has more information: the language chosen by the user for spell-checking (which some UAs such as Firefox allow users to change via the context menu in textareas or contenteditable elements) is likely to match the languge text being entered. Also, if an IME for a particular language is on, it is highly likely that that is the correct language. The UA could even do some kind of content analysis to guess, based on what the user has actually typed, what the language is.
I think that it could be useful to let authors opt-into this kind of UA language detection for editable elements.