-
Notifications
You must be signed in to change notification settings - Fork 62
Description
What happened?
Product: WebView2 Runtime (Chromium-based)
SDK Version: 1.0.3351.48
Runtime Version: 137.0.3296.93
OS: Windows 11 24H2 (build 26100.4484)
Edge Version : 138.0.3351.55
Repro Steps
-
In native C++, create a WebView2 environment with
ComPtr<ICoreWebView2EnvironmentOptions> options = Make<CoreWebView2EnvironmentOptions>(); options->put_Language(L"nl"); CreateCoreWebView2EnvironmentWithOptions(nullptr, nullptr, options.Get(), …);
-
Create a WebView2 controller and navigate to an HTML page containing:
<div id="editor"> <div class="ql-editor" contenteditable="true" lang="fr"> Ceci est un texte français correct. </div> </div>
-
Note that all words are underlined in red—even though
lang="fr"and the text is valid French. -
Change the
langattribute dynamically via JavaScript (e.g. to"nl"or"en"). The spellchecker never re-evaluates against the new language. -
Conversely, if you initialize the environment with
put_Language(L"fr"), then French text is not underlined, but all other languages (including correct English or Dutch) are.
Expected Behavior
- Spellchecking should respect the HTML5
langattribute oncontenteditable(and<input>/<textarea>) elements and switch dictionaries dynamically. - Updating
langin the DOM should trigger a re-evaluation of the spellcheck dictionary for that element or subtree. ICoreWebView2EnvironmentOptions::Languageshould set only the UI language (menus, dialogs, Accept-Language header), not override per-element content language.
Actual Behavior
- WebView2 uses the dictionary associated with the Environment language (set via
put_Language) for all content, ignoring per-elementlangattributes. - Dynamically changing
langin the page has no effect on which spellcheck dictionary is used. - Languages with no installed dictionary (e.g. Greek on my machine) appear un-squiggled only because spellcheck is effectively disabled—not because
langis honored.
Impact
Multilingual editors (QuillJS, CKEditor, TinyMCE, custom rich-text controls) cannot provide correct, per-segment spellchecking. The only workaround is to spin up separate WebView2 instances per language or disable spellcheck entirely.
Workarounds Tried
- Installing Windows “Proofing Tools” and Edge spellcheck dictionaries for each language.
- Toggling
spellcheckattr off/on at runtime, refocusing, DOM re-insertion. - Removing and re-adding languages in
edge://settings/languages. - Confirming
langis present on.ql-editorand re-loading WebView.
None of these restore per-element spellcheck.
Suggested Fix / Enhancement
- Expose an API to explicitly set/query spellcheck dictionaries at runtime (per-view or per-element), but the best way would simply to consider the html lang attributes on elements.
- Have Chromium re-evaluate dictionaries when
langattributes change (align with HTML5 spec “hints” for spellcheck). - Decouple the environment’s
Language(UI/headers) from content spellcheck dictionaries.
Sample Minimal Repro
- Host process: native C++ using WebView2 SDK
- Environment creation: as above, with
put_Language(L"nl") - HTML page: simple contenteditable div with varying
langvalues - Observe: always Dutch spellcheck, never French (or English, or German) as indicated by
lang
Please let me know if you need any further details. Thank you for taking multilingual support seriously!
Importance
Moderate. My app's user experience is affected, but still usable.
Runtime Channel
Stable release (WebView2 Runtime)
Runtime Version
137.0.3296.93
SDK Version
1.0.3351.48
Framework
Win32
Operating System
Windows 11
OS Version
26100.4484
Repro steps
-
In native C++, create a WebView2 environment with
ComPtr<ICoreWebView2EnvironmentOptions> options = Make<CoreWebView2EnvironmentOptions>(); options->put_Language(L"nl"); CreateCoreWebView2EnvironmentWithOptions(nullptr, nullptr, options.Get(), …);
-
Create a WebView2 controller and navigate to an HTML page containing:
<div id="editor"> <div class="ql-editor" contenteditable="true" lang="fr"> Ceci est un texte français correct. </div> </div>
-
Note that all words are underlined in red—even though
lang="fr"and the text is valid French. -
Change the
langattribute dynamically via JavaScript (e.g. to"nl"or"en"). The spellchecker never re-evaluates against the new language. -
Conversely, if you initialize the environment with
put_Language(L"fr"), then French text is not underlined, but all other languages (including correct English or Dutch) are.
Repros in Edge Browser
Yes, issue can be reproduced in the corresponding Edge version
Regression
No, this never worked
Last working version (if regression)
No response