Re: [whatwg/dom] Proposal: Spellcheck API (#547)

tmccombs left a comment (whatwg/dom#547)

> I suspect this is probably better proposed at https://github.com/whatwg/html or https://github.com/w3c/editing as the DOM Standard is fairly low-level and UI-agnostic (at least thus far).

Maybe I'm missing something, but this proposal is pretty low level, and UI agnostic. It is a javascript API for checking if a string is spelled correctly. *Maybe* it could belong to editing, since it would probably primarily be used by code around editing text. But wouldn't necessarily be used by traditional editing elements like input and textarea.

> In particular, custom words could greatly facilitate user fingerprinting and even inadvertently publicize secret information that a user may reasonably expect to be kept private to their device, such as acquaintences’ personal names or politically sensitive terms.

The way I would address that is, by default, this API will not expose any custom words from the user's general custom wordlist. But then also have a method on `Spellchecker` that allows the user of the API to add their own list of custom words *to that instance of the spellchecker*, that may include words the user has added through a custom API that are stored in local storage, or associated with the user on the server, or add words that are domain specific to the application, etc. 

I think it could make sense to allow users to grant a page access to their custom word list, but I think it should definitely be opt-in, and I'm not sure it would be a good idea to provide an API to ask the user for the permission (i.e. the user has to explicitly grant the access through some UI).

----

I would probably add a method to `SpellCheckingRangeResult`  like `suggestions() => Promise.<Array.<string>> `  that returns a (possibly empty) list of suggestions for corrections. 

Also, I think it should be "orthography" not "ortography".

-----

My main use case for wanting this  is that I have a text editor that is drawn completely on a `<canvas>`, and uses a custom context menu. As such, it can't make use of the browser's built-in spell checking functionality.  Currently the only options are to do spell checking on the server, or use a javascript or wasm client spellchecker. But it would be really nice if I could take advantage of the spell checker that the browser already has built in.

While it would be nice to have access to the user's custom words for spellchecking, even without that, this would be better than what we have today.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/547#issuecomment-3969379684
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/dom/issues/547/3969379684@github.com>

Received on Thursday, 26 February 2026 21:39:19 UTC