Skip to content

The lang attribute and user input #4765

@frivoal

Description

@frivoal

https://html.spec.whatwg.org/multipage/dom.html#the-lang-and-xml:lang-attributes

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    addition/proposalNew features or enhancementsi18n-trackerGroup bringing to attention of Internationalization, or tracked by i18n but not needing response.needs implementer interestMoving the issue forward requires implementers to express interesttopic: forms

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions