Skip to content

fix(files): keep the reader's caret when the markdown editor settles - #10263

Merged
waleedlatif1 merged 1 commit into
stagingfrom
fix/markdown-settle-keeps-caret
Nov 21, 2026
Merged

waleedlatif1 merged 1 commit into
stagingfrom
fix/markdown-settle-keeps-caret

Conversation

@waleedlatif1

@waleedlatif1 waleedlatif1 commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • On every settle the rich markdown editor collapses its selection to the end of the document, so a select-all mapped onto the new content doesn't keep painting every divider and image. It did this for a plain caret too. An editor that is already editable can take a click before its first settle lands, so the reader's caret jumped to the end of the document right after they clicked
  • The settle (and the deferred collapse a superseded settle owes) now collapses only a non-empty selection. A caret stays where it was put
  • This is the cause of the intermittent markdown-viewer e2e failure "Keyboard selection did not select text": after a reload the test clicks into "bold", a late settle moves the caret to the end of the document, and Shift+ArrowRight selects nothing. It has failed this way on several branches, most recently with the selection still empty after 5s
  • Reverts the markdown-viewer selection step from improvement(ci): install e2e browser system packages from a per-image cache #10258 (setting the caret with getSelection().collapse) back to the original keyboard-only ArrowLeft + Shift+ArrowRight. In WebKit the programmatic caret did not hold, and the check failed on two of four runs after it merged. The check now waits for the selection to be non-empty instead of reading it once

Type of Change

  • Bug fix

Testing

  • The markdown-viewer e2e (apps/sim/scripts/test-markdown-viewer-e2e.ts) exercises this path in Chromium and WebKit on this PR
  • biome, check:comment-hygiene

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Nov 21, 2026 12:07am UTC

Request Review

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 1 file

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@greptile-apps

greptile-apps Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The change appears safe to merge.

Summary

Preserves an existing caret when the markdown editor settles.

  • The markdown editor keeps a caret in place when content settles.

No actionable issues were found in the changed code.

Reviews (2) · Last reviewed commit: "fix(files): keep the reader's caret when..." · Reviewed by Greptile

@waleedlatif1
waleedlatif1 merged commit 1734687 into staging Nov 21, 2026
76 of 77 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/markdown-settle-keeps-caret branch November 21, 2026 00:12
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 1 file

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

This branch was previously deployed

1 inactive deployment
Preview — edcc20f2 Deployed Nov 21, 2026 by vercel[bot]
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