Skip to content

fix(core): skip a hidden empty line on a click below the doc - #787

Draft
ocavuebot wants to merge 1 commit into
masterfrom
fix/click-below-hidden-line
Draft

ocavuebot wants to merge 1 commit into
masterfrom
fix/click-below-hidden-line

Conversation

@ocavuebot

Copy link
Copy Markdown
Collaborator

A click below the last block returned early when the bottom textblock was an empty line, so the browser placed the caret there. When that line is a child of a folded bullet, it is hidden with display: none:

  • With native caret placement, the browser skips hidden content, so the caret lands at the end of the visible line.
  • prosemirror-view 1.43 places the caret itself with posAtCoords and TextSelection.near. Those do not check visibility, so the caret goes into the hidden line. In Firefox, typed text goes there too. This fails "keeps the caret visible when the empty line is folded away" on 1.43.0-beta3.

Changes:

  • The early return now applies only when the empty bottom line is rendered (getClientRects().length > 0).
  • When it is hidden, and the click is below the last block, the caret goes to the end of the last rendered textblock. Hidden subtrees are skipped.

The extra layout read runs only on a press below the last block whose bottom line is empty, after the other early returns.

click-below.test.tsx passes in Chromium, Firefox, and WebKit with both prosemirror-view 1.42.9 and 1.43.0-beta3.

Written by Claude Opus 5.5.

@vercel

vercel Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
meowdown Ignored Ignored Nov 14, 2026 1:36am UTC

@coderabbitai

coderabbitai Bot commented Nov 14, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@ocavuebot ocavuebot changed the title fix(core): skip a hidden empty line in a click below the last block fix(core): skip a hidden empty line on a click below the doc Nov 14, 2026
@github-actions

Copy link
Copy Markdown

@pkg-pr-new

pkg-pr-new Bot commented Nov 14, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: 75cd984

@github-actions

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 93.49% 6890 / 7369
🔵 Statements 92.39% 8491 / 9190
🔵 Functions 90.2% 1520 / 1685
🔵 Branches 88.43% 5652 / 6391
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/core/src/extensions/click-below.ts 89.83% 85% 100% 97.87% 41, 49, 70, 71, 77, 85
Generated in workflow #3108 for commit 75cd984 by the Vitest Coverage Report Action

This branch has not been deployed

No deployments
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.

2 participants