Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Renderer spellcheck API does not work on Windows #28684

Open
3 tasks done
lishid opened this issue Apr 15, 2021 · 24 comments
Open
3 tasks done

[Bug]: Renderer spellcheck API does not work on Windows #28684

lishid opened this issue Apr 15, 2021 · 24 comments
Labels
11-x-y 12-x-y bug 🪲 has-repro-gist Issue can be reproduced with code at https://gist.github.com/ platform/windows

Comments

@lishid
Copy link
Contributor

lishid commented Apr 15, 2021

Preflight Checklist

Electron Version

12.0.4

What operating system are you using?

Windows

Operating System Version

Windows 10 1909

What arch are you using?

x64

Last Known Working Electron version

None

Expected Behavior

Expecting require('electron').webFrame.isWordMisspelled('testt') to return true.

Actual Behavior

require('electron').webFrame.isWordMisspelled('testt') returns false.

Testcase Gist URL

https://gist.github.com/lishid/53782e6e43f4bc431ac1fed3bff33c85

@lishid
Copy link
Contributor Author

lishid commented Apr 15, 2021

Previously on #28404 (Issue was erroneously closed and subsequently forgotten). Please consider re-opening original issue if marking this one is as duplicate.

This API works on Linux perfectly fine. On Windows, despite the textarea detecting the spell error, the API still returns false.

@mlaurencin mlaurencin added 12-x-y has-repro-gist Issue can be reproduced with code at https://gist.github.com/ platform/windows labels Apr 26, 2021
@Jelmerro
Copy link

A user of one of my apps ran into this same issue, and when I started testing I noticed something strange. It actually does work for some languages on Windows (in my case nl), but it stops working when switching back to en-US. It also doesn't work before calling setSpellCheckerLanguages.

It works flawlessly on Linux, even before calling the language list API. And keeps working once you do call it regardless of the language list.

@abnerlee
Copy link

Confirmed this bug too on v12.0.7 / windows 10.

Set en-GB works, but en-US is not working.

@VerteDinde
Copy link
Member

Hey @Jelmerro, thanks for reporting this issue! I just took a look at your Fiddle gist and want to make sure I'm not misunderstanding - when I run the repro, I'm also seeing the test fail going back to (at least) Electron 8.5.5.

Can you confirm whether or not this ever worked as expected for your app, or did this break for you in Electron 12? Having that bisect is helpful to us when trying to solve the issue, so I just wanted to double check.

@Jelmerro
Copy link

I did not report this issue, this is just something I ran into when working on one of my projects. It has been an issue for a while, that's why I thought that the other one was related as well. I only added word suggestions in a custom context menu when I was already on electron 12.0.5, but I can also reproduce this for much older versions (I just tested 8.5.5) as well.

@fxha
Copy link

fxha commented Jan 15, 2022

We have the same issue while trying to replace node-spellchecker with the built-in one and verified this on Electron v15 and v16. I guess this issue will be in backlog for a while but our observations:

  1. Windows only issue, the same logic runs without any problems on Linux (Hunspell)
  2. session.availableSpellCheckerLanguages are on both OSs the same -> Windows using Hunspell too?!
  3. dictionarySuggestions from win.webContents.on('context-menu', ... works on Windows successfully
  4. webFrame.getWordSuggestions and webFrame.isWordMisspelled are always empty/false on Windows without errors shown in log (--enable-logging)
  5. Misspelled words are red underlined in editable text

My wild guess is that this is an issue with the Windows spell checker and Chromium. Maybe we hitting a precondition because Electron expects to use Hunspell but Chromium expects to have a valid platform specific spell checker in the renderer. Unfortunately, I'm unable to build Chromium and hope this can be fixed. For now, both APIs have no functionality on Windows.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 6, 2022

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

@github-actions github-actions bot added the stale label Oct 6, 2022
@lishid
Copy link
Contributor Author

lishid commented Oct 6, 2022

Don't think this was ever fixed.

@github-actions github-actions bot removed the stale label Oct 7, 2022
@craftzdog
Copy link

Still not working on Electron 21

@Fevol
Copy link

Fevol commented Jan 8, 2023

I can confirm that this bug is still happening on Electron v22. From my own testing, it seems that both English dictionaries (i.e.: en-US, en-GB) do not work via the API on Windows, whereas other languages like nl, de work fine. On Linux, all (tested) languages work properly. See the demo below:

electron-spellchecker-bug

The fields mispelled: and suggestions: display the outputs of webFrame.isWordMisspelled() and webFrame.getWordSuggestions() respectively. The spellchecker languages are updated in the main process with session.defaultSession.setSpellCheckerLanguages(LANGUAGES).

Perhaps this is unrelated, but it seems to me like only one language is checked in the textarea itself. Is this expected behaviour?

Testcase gist URL

https://gist.github.com/Fevol/9ec53ef916414737b63eac1ea2a5318b

@github-actions
Copy link
Contributor

github-actions bot commented Apr 9, 2023

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

@github-actions github-actions bot added the stale label Apr 9, 2023
@Jelmerro
Copy link

Jelmerro commented Apr 9, 2023

Still seems like an issue if you use the "wrong" dictionary in 24.0.0 on Windows only.

@Fevol
Copy link

Fevol commented Apr 9, 2023

Also retested using my testcase -- the issue is definitely still present with the latest version (v24.0.0).

@github-actions
Copy link
Contributor

github-actions bot commented Jul 9, 2023

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

@github-actions github-actions bot added the stale label Jul 9, 2023
@Jelmerro
Copy link

Jelmerro commented Jul 9, 2023

still an issue

@github-actions github-actions bot removed the stale label Jul 10, 2023
@electron-issue-triage
Copy link

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

@Jelmerro
Copy link

Jelmerro commented Oct 9, 2023

still an issue

@Phylu
Copy link

Phylu commented Nov 19, 2023

I can confirm this still being an issue. The e-mail client Mailspring is affected by it. See:

Some debugging led me to the assumption, that the correct dictionaries may not be downloaded and are therefore not available by Electron. See: #29348

I am using German as my default system language. When I configure e.g. an English dictionary, I get the events that it was downloaded successfully before initializing the spellcheck. When I instruct electron to use German as the spellchecking language, I only get the events fired that the dictionary was loaded. See:

[9496:1119/114848.997:INFO:CONSOLE(91)] "Spellchecker - Dictionary Download Success: en-GB", source: /app/src/spellchecker.ts (91)
[9496:1119/114849.002:INFO:CONSOLE(85)] "Spellchecker - Dictionary Initialized: en-GB", source: /app/src/spellchecker.ts (85)

[9496:1119/115114.926:INFO:CONSOLE(85)] "Spellchecker - Dictionary Initialized: de-DE", source: app/src/spellchecker.ts (85)

@electron-issue-triage
Copy link

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

@Jelmerro
Copy link

still an issue.

@theDevelopper
Copy link

can confirm. Still an issue.

@alex1701c
Copy link

I can confirm this still being an issue. The e-mail client Mailspring is affected by it. See:

Some debugging led me to the assumption, that the correct dictionaries may not be downloaded and are therefore not available by Electron. See: #29348

I am using German as my default system language. When I configure e.g. an English dictionary, I get the events that it was downloaded successfully before initializing the spellcheck. When I instruct electron to use German as the spellchecking language, I only get the events fired that the dictionary was loaded. See:

[9496:1119/114848.997:INFO:CONSOLE(91)] "Spellchecker - Dictionary Download Success: en-GB", source: /app/src/spellchecker.ts (91)
[9496:1119/114849.002:INFO:CONSOLE(85)] "Spellchecker - Dictionary Initialized: en-GB", source: /app/src/spellchecker.ts (85)

[9496:1119/115114.926:INFO:CONSOLE(85)] "Spellchecker - Dictionary Initialized: de-DE", source: app/src/spellchecker.ts (85)

How did you get logging output like this?

@Phylu
Copy link

Phylu commented May 7, 2024

How did you get logging output like this?

@alex1701c I added some debug logs to the source code to trace the issue.

@papuche
Copy link

papuche commented May 8, 2024

How did you get logging output like this?

@alex1701c you can use electron events to add some logs https://www.electronjs.org/docs/latest/api/session#event-spellcheck-dictionary-download-begin

My guess is the spellcheck does not work for the languages we have already configured in Windows settings "Language & region."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
11-x-y 12-x-y bug 🪲 has-repro-gist Issue can be reproduced with code at https://gist.github.com/ platform/windows
Projects
None yet
Development

No branches or pull requests