Free text stays scrolled to the caret after editing ends

Open Beginner friendly
#861 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@chahore is already working on this.

Since Oct 11, 2026.

  • #862 by @chahore — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
react, typescript
Domain
frontend

Research direction

Start in packages/framework/react/src/annotation.tsx at FreeText, where the issue says scrollTop is reset when editing begins. Trace how the box is rendered after editing ends while its source is vector, then reset its scroll so the first line is visible. Done when text that overflowed during editing starts at its first line after clicking away; the payload names no test, so inspect nearby tests for coverage.

Written by the indexing model from the issue text.

Description

Version: 3.0.0-next.14, @embedpdf/react.

What happens: Type into a free-text box until the text runs past the bottom of the box. The browser scrolls the box to follow the caret. Click away to end editing: the box still shows the last lines, scrolled to where the caret was, instead of the text from its first line.

Expected: Once editing ends, the box shows its text from the first line, clipped at the bottom, the way the baked appearance does.

Cause: FreeText in packages/framework/react/src/annotation.tsx resets scrollTop to 0 only when editing begins. After a text edit the box is drawn live (its source is vector), so the element stays mounted with the scroll the browser applied.

Dominant language
TypeScript
Stars
4.5k
Forks
317
Avg merge
10h 16m
Merged PRs (30d)
174

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from embedpdf/embed-pdf-viewer

All issues in embedpdf/embed-pdf-viewer

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.