leafwiki icon indicating copy to clipboard operation
leafwiki copied to clipboard

Enable the browser's native spellcheck in the editor

Open perber opened this issue 1 month ago • 0 comments

From discussion #1726: the Markdown editor shows no spellcheck in any browser (Firefox, Chrome, with and without spellcheck extensions).

Cause

The editor is CodeMirror 6 (MarkdownCodeEditor.tsx). CodeMirror sets spellcheck="false" on its content element by default, so the browser's built-in spellcheck never runs.

Proposal

As a first step, turn the browser's native spellcheck on via EditorView.contentAttributes.of({ spellcheck: 'true', autocorrect: 'on', autocapitalize: 'on' }). No custom dictionary or spellcheck engine.

Things to check:

  • The spellcheck language follows the page's lang attribute / browser settings; check that it matches the UI locale or the user's browser language sensibly.
  • Code blocks, inline code, URLs and frontmatter will get flagged. Decide whether that's acceptable for a first version or whether those ranges should get spellcheck="false" via a decoration.
  • Possibly a user setting to turn it off.
  • Behaviour on mobile (autocorrect/autocapitalize can be annoying while typing Markdown syntax).

perber avatar Oct 24 '26 16:10 perber