[BUG] Markdown viewer: search forces Preview→Code, and toggling views resets scroll to top

Status Open
Maintainer reply None cached
Activity 0 comments · opened Sep 12, 2026

Environment

  • Claude Code desktop app (Code tab), Windows 11 Pro 26200
  • Affects the built-in Markdown viewer used to preview .md files

Summary

Two issues in the Markdown viewer that individually are annoyances and together make long documents
genuinely hard to work with.

---

1. Clicking the search (magnifier) icon force-switches Preview → Code

Steps to reproduce

  1. Open a .md file in the viewer, in Preview mode.
  2. Click the magnifier icon to search within the document.

Actual: the viewer switches from Preview to Code view.

Expected: stay in Preview. Searching is a read operation and shouldn't change the rendering
mode. If search is only implemented against the raw source, it would be better to search the
rendered text, or at minimum return to Preview when the search closes.

---

2. Toggling Preview ↔ Code resets scroll to the top of the document

Steps to reproduce

  1. Open a long .md file in the viewer.
  2. Scroll to somewhere in the middle or near the end.
  3. Toggle Preview → Code (or Code → Preview).

Actual: the viewer jumps back to the very beginning of the document. The previous position is
lost.

Expected: preserve the reading position across the toggle, or approximate it (e.g. map by
nearest heading or by line/scroll ratio). Exact mapping between rendered and raw views is hard, but
an approximation is far better than resetting to the top.

---

Why they compound

The two interact badly. A normal search flow is: click the magnifier → get bounced into Code view →
switch back to Preview → and now you're at the top of the document, having lost both your search
context and your reading position.

This gets painful on long documents. I hit it on a 2,200-line QA plan: every search meant
scrolling all the way back down to where I was.

Suggested priority

Issue 2 (scroll reset) is the more disruptive of the two, since it affects every mode toggle, not
just searching.

View original on GitHub ↗