Skip to content

🐛 fix(editor): expose spellCheck prop, suppress Safari inline predictive text#161

Open
arvinxx wants to merge 8 commits into
masterfrom
feat/spellcheck-prop
Open

🐛 fix(editor): expose spellCheck prop, suppress Safari inline predictive text#161
arvinxx wants to merge 8 commits into
masterfrom
feat/spellcheck-prop

Conversation

@arvinxx
Copy link
Copy Markdown
Member

@arvinxx arvinxx commented May 25, 2026

Problem

Safari 18+ (macOS Sequoia) enables inline predictive text by default on all contenteditable elements. The ReactPlainText component rendered a bare contentEditable div with no spellCheck attribute, causing Safari's Apple Intelligence text predictions to appear inside the chat input.

Changes

src/plugins/common/react/type.ts

  • Added spellCheck?: boolean to ReactPlainTextProps with JSDoc explaining the Safari/WebKit behavior.

src/plugins/common/react/ReactPlainText.tsx

  • Accept spellCheck prop and forward it to the inner contentEditable div.
  • Default value: !enablePasteMarkdown
    • When enablePasteMarkdown is true (default, chat input), spellCheck defaults to false → suppresses Safari predictive text.
    • When enablePasteMarkdown is false (plain text mode, e.g. pure code editor), spellCheck defaults to true → normal browser spellcheck.
    • Callers can always override explicitly.

src/react/Editor/Editor.tsx

  • No change needed — EditorProps already extends Omit<ReactPlainTextProps, 'children'>, so spellCheck is automatically part of the public API.

Why spellCheck={false} fixes it

Per WebKit commit 2d67e9c, setting spellcheck=false on a contentEditable element also suppresses platform-level spellchecking and inline text prediction in Safari. This is the most reliable and standards-compliant approach — autocomplete attributes have no effect on contenteditable divs.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lobe-editor Ready Ready Preview, Comment May 25, 2026 9:21am

Request Review

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've reviewed this pull request using the Sourcery rules engine

@arvinxx arvinxx changed the title feat(editor): expose spellCheck prop, suppress Safari inline predictive text 🐛 fix(editor): expose spellCheck prop, suppress Safari inline predictive text May 25, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 25, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@lobehub/editor@161

commit: 8fcd298

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant