Skip to content

markdown: Reset preview scroll for new files - #333464

Merged
Dmitriy Vasyura (dmitrivMS) merged 1 commit into
mainfrom
fix/markdown-preview-scroll-reset
Aug 31, 2026
Merged

markdown: Reset preview scroll for new files#333464
Dmitriy Vasyura (dmitrivMS) merged 1 commit into
mainfrom
fix/markdown-preview-scroll-reset

Conversation

@dmitrivMS

@dmitrivMS Dmitriy Vasyura (dmitrivMS) commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator
  • reset persisted Markdown preview scroll progress when opening a different file without an explicit source line
  • preserve source-line and fragment-based preview navigation

Fixes #164071

Validation

  • npm run build-webview --prefix .\extensions\markdown-language-features
  • Code OSS: Explorer Open Preview resets a different file to the top
  • Code OSS: plain relative links reset the linked file to the top
  • Code OSS: relative fragment links reveal the requested heading
  • Code OSS: reopening or hiding/revealing the same preview preserves its scroll position
  • Code OSS: opening a long file from source line 0 starts at the top (regression from Markdown scrolls to bottom of doc #168223)
  • Code OSS: explicit source-line navigation wins over stale scroll progress, both when opening to the side and when an unlocked preview switches resources

Fixes #164071

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings August 31, 2026 07:07
@dmitrivMS Dmitriy Vasyura (dmitrivMS) added bug Issue identified by VS Code Team member as probable bug markdown-ext The Markdown extension: language features and preview labels Aug 31, 2026

Copilot AI 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.

Copilot review overview

Review tier: Balanced
Findings: None

What changed in this PR

Resets Markdown preview scrolling when navigating to a different file while preserving explicit line and fragment navigation.

Changes:

  • Resets persisted scroll progress to the top for newly opened files.
  • Retains existing source-line and fragment behavior.
File Description
extensions/​markdown-language-features/​preview-src/​index.ts Resets stale preview scroll progress when switching resources.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@dmitrivMS Dmitriy Vasyura (dmitrivMS) removed the bug Issue identified by VS Code Team member as probable bug label Aug 31, 2026
@dmitrivMS
Dmitriy Vasyura (dmitrivMS) merged commit 81ba365 into main Aug 31, 2026
38 checks passed
@dmitrivMS
Dmitriy Vasyura (dmitrivMS) deleted the fix/markdown-preview-scroll-reset branch August 31, 2026 08:36
@vs-code-engineering vs-code-engineering Bot added this to the 1.137.0 milestone Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

markdown-ext The Markdown extension: language features and preview

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Markdown preview does not scroll to top on new URI

4 participants