Skip to content

feat: keep the caret inside the visual viewport - #789

Draft
ocavuebot wants to merge 3 commits into
masterfrom
visual-viewport-caret
Draft

ocavuebot wants to merge 3 commits into
masterfrom
visual-viewport-caret

Conversation

@ocavuebot

@ocavuebot ocavuebot commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

When a software keyboard overlays the page instead of resizing it (iOS 26 WKWebView with a pinned scroll view, or a layout that keeps 100dvh), scroll containers reach under the keyboard and ProseMirror treats the caret behind it as visible. While visualViewport shows less than the full layout viewport at page scale 1, the scroll-to-selection takeover now handles every selection and clips each container's box to the visible span, and a focused editor scrolls its selection into view again when the covered bottom grows. With the full viewport visible, the default ProseMirror path runs as before, so desktop behavior is unchanged. A pinch-zoomed page also keeps the default path, because the browser pans the visual viewport to the caret itself.

Manual check, since a test iframe never gets a smaller visual viewport: in an iOS 26 simulator with the software keyboard, host the editor in a full-height scroller, tap a line that the keyboard will cover, and type; the caret stays above the keyboard.

@vercel

vercel Bot commented Nov 17, 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 17, 2026 4:15am UTC

@coderabbitai

coderabbitai Bot commented Nov 17, 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

@github-actions

Copy link
Copy Markdown

@pkg-pr-new

pkg-pr-new Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

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

commit: edd61ab

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 93.43% 6901 / 7386
🔵 Statements 92.28% 8503 / 9214
🔵 Functions 90.18% 1525 / 1691
🔵 Branches 88.34% 5669 / 6417
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/core/src/extensions/scroll-to-selection.ts 80.7% 72.82% 93.33% 85.26% 39, 45, 55, 84-86, 91, 93, 111, 113-118, 123-128, 160-161, 169, 177, 183, 215, 220, 228-229
Generated in workflow #3114 for commit edd61ab 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