Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Bug: CodeView search jumps to the bottom on an offscreen match

Open
#1,138 3 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

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

Research direction

Start by running the provided reproduction with @pierre/diffs 1.4.2, then trace how CodeView handles search-match navigation and renders the selected match. Check the fourth match at line 201 in the 800-line editable file. Done means selecting it scrolls the match into view, while search and manual scrolling remain usable.

Written by the indexing model from the issue text.

Description

bug
Prerequisites
Describe the issue

In an editable CodeView with default options, the first three search matches work. Navigating to the fourth match (line 201) jumps to the bottom of the 800-line file instead. The search panel shows 4 of 4, but line 201 is not rendered.

Expected: The selected match scrolls into view, and search and manual scrolling remain usable.

Reproduction
  1. Mount the component below and click inside the text.
  2. Open search with Cmd/Ctrl+F and enter github.
  3. Press Enter three times to select the fourth match.
import type { CodeViewItem } from "@pierre/diffs";
import { Editor, type EditorFactory } from "@pierre/diffs/edit";
import { CodeView, EditProvider } from "@pierre/diffs/react";

const createEditor: EditorFactory<undefined, undefined> = (
    editorType,
    options,
    editStateKey,
) => new Editor(editorType, options, editStateKey);

const matchLines = [125, 126, 128, 201];

const items: CodeViewItem<undefined>[] = [
    {
        id: "file",
        type: "file",
        edit: true,
        version: 1,
        file: {
            name: "example.txt",
            contents: Array.from({ length: 800 }, (_, index) =>
                matchLines.includes(index + 1)
                    ? `github match at ${index + 1}`
                    : `line ${index + 1}`,
            ).join("\n"),
        },
    },
];

export default function SearchReproduction() {
    return (
        <EditProvider createEditor={createEditor}>
            <CodeView
                items={items}
                style={{ height: 560, overflow: "auto" }}
            />
        </EditProvider>
    );
}
What browser(s) are you seeing the problem on?

Chrome

What version of @pierre/diffs are you using?

1.4.2

Dominant language
TypeScript
Stars
6.2k
Forks
226
Avg merge
1d 11h
Merged PRs (30d)
34

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 pierrecomputer/pierre

All issues in pierrecomputer/pierre

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.