Skip to content

fix(core): guard code blocks against leaked native Enter on WebKit - #522

Open
ocavue wants to merge 4 commits into
masterfrom
fix/safari-code-block-enter-guard
Open

fix(core): guard code blocks against leaked native Enter on WebKit #522
ocavue wants to merge 4 commits into
masterfrom
fix/safari-code-block-enter-guard

Conversation

@ocavue

@ocavue ocavue commented Aug 30, 2026

Copy link
Copy Markdown
Member

prosemirror-view lets some Safari Enter keydowns reach native editing (every plain Enter on iOS, and the first keydown within 500ms after compositionend on desktop), and WebKit then clone-splits the <pre>, leaving a rogue <br> in the code block or silently deleting the text before the caret. This adds a beforeinput guard that cancels insertParagraph / insertLineBreak inside a code block on WebKit and reruns the key through the keymap pipeline. Draft until the iOS side is verified on a real device (canceling beforeinput must not confuse the virtual keyboard).

@vercel

vercel Bot commented Aug 30, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
meowdown Ready Ready Preview Aug 30, 2026 4:10pm

@coderabbitai

coderabbitai Bot commented Aug 30, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 19 minutes.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a821c981-12b1-47d8-883d-102fee03fa1d

📥 Commits

Reviewing files that changed from the base of the PR and between ebc802d and 0f79bfe.

📒 Files selected for processing (4)
  • packages/core/src/extensions/code-block-enter-guard.ts
  • packages/core/src/extensions/extension.ts
  • packages/core/src/utils/browser.ts
  • packages/react/src/components/code-block-enter.test.tsx

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 30, 2026

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 93.95% 5094 / 5422
🔵 Statements 91.64% 5757 / 6282
🔵 Functions 91.91% 1216 / 1323
🔵 Branches 87.62% 3731 / 4258
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/core/src/extensions/code-block-enter-guard.ts 23.52% 16.66% 66.66% 23.07% 27-50
packages/core/src/extensions/extension.ts 100% 100% 100% 100%
packages/core/src/utils/browser.ts 100% 100% 100% 100%
Generated in workflow #2062 for commit 0f79bfe by the Vitest Coverage Report Action

@pkg-pr-new

pkg-pr-new Bot commented Aug 30, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@meowdown/core@522
npm i https://pkg.pr.new/@meowdown/markdown@522
npm i https://pkg.pr.new/@meowdown/react@522

commit: 0f79bfe

@ocavue ocavue changed the title fix(core): guard code blocks against leaked native Enter on WebKit fix(core): hide the native caret in noLink units Aug 30, 2026
@ocavue
ocavue marked this pull request as ready for review August 30, 2026 16:13
@ocavue ocavue changed the title fix(core): hide the native caret in noLink units fix(core): guard code blocks against leaked native Enter on WebKit Aug 30, 2026
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