Skip to content

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

Closed

Description

@lishid

Preflight Checklist

Electron Version

12.0.2

What operating system are you using?

Windows

Operating System Version

Windows 10 1909

What arch are you using?

x64

Last Known Working Electron version

No response

Expected Behavior

renderer.js

let element = document.createElement('textarea');
element.spellcheck = true;
element.value = 'testt';
document.body.appendChild(element);
element.focus();

setInterval(() => {
  console.log(require('electron').webFrame.isWordMisspelled('testt'))
}, 1000);

Expected: Console log repeatedly print "true"

Actual Behavior

Actual: Console log repeatedly prints "false"

Testcase Gist URL

(edit ckerr): https://gist.github.com/ckerr/91b84f22d5beeef1506174b495720dd7

Concerning the API released in #25060

@zcbenz Noticed you were working on spellcheck related tests. It seems that the tests for this API don't run on Windows so it wasn't caught:

const shouldRun = process.platform !== 'win32';

This seems to work on Linux for me, but not on Windows.

Activity

  1. ckerr commented on Mar 29, 2021

    @ckerr
    Member

    Confirmed works on Linux. Tested with Electron 12.0.2 on Ubuntu 20.10.

    Electron fiddle test: https://gist.github.com/ckerr/91b84f22d5beeef1506174b495720dd7

  2. added
    has-repro-gist
    on Mar 29, 2021
  3. codebytere commented on Mar 31, 2021

    @codebytere
    Member

    This is because by default the spellchecker only automatically detects language on macOS - see:

    #### `ses.setSpellCheckerLanguages(languages)`
    * `languages` String[] - An array of language codes to enable the spellchecker for.
    The built in spellchecker does not automatically detect what language a user is typing in. In order for the
    spell checker to correctly check their words you must call this API with an array of language codes. You can
    get the list of supported language codes with the `ses.availableSpellCheckerLanguages` property.
    **Note:** On macOS the OS spellchecker is used and will detect your language automatically. This API is a no-op on macOS.

    If you add session.defaultSession.setSpellCheckerLanguages(['en-US']) to your Fiddle before you create the window the test will pass.

  4. lishid commented on Mar 31, 2021

    @lishid
    ContributorAuthor

    I have tried adding session.defaultSession.setSpellCheckerLanguages(['en-US']) in my fiddle right before new BrowserWindow but I can still repro this issue.

    An observation is that Electron correctly spellchecks the textarea with English, without having to set the language, but the API still returns false on the identically misspelled word.

    image

  5. lishid commented on Apr 2, 2021

    @lishid
    ContributorAuthor

    @codebytere Can you verify/repro this on Windows?

  6. lishid commented on Apr 8, 2021

    @lishid
    ContributorAuthor

    @ckerr Any chance we can have this re-opened?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    12-x-ybug 🪲component/spellcheckhas-repro-gistplatform/windows

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions