Skip to content

Markdown preview exit locks editor scroll position, causing jump on tab switch #319080

@gomico

Description

@gomico

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.122.1 (user setup)
  • OS Version: Windows_NT x64 10.0.26100

Steps to Reproduce:

  1. Open or create a new untitled Markdown file. Fill it with enough lines (e.g. 200 lines of 1\n\n each) so the preview height exceeds the screen.
  2. Scroll the editor to the top, then use Ctrl+Shift+V (markdown.togglePreview) to enter preview.
  3. Scroll the preview to the bottom, then use Ctrl+Shift+V again to exit preview. Observe that the editor now shows the last few lines at the top — the scroll position has been "locked" to the source line corresponding to the top of the preview at exit.
  4. Scroll the editor back to the top (via scroll wheel or Ctrl+Home).
  5. Switch to another editor (any language), then switch back to the Markdown editor — using mouse click, Ctrl+Tab (workbench.action.nextEditor / workbench.action.previousEditor), or Alt+← (workbench.action.navigateBack).
  6. Bug: The editor jumps back to the locked position from step 3. When switching back from another editor group via mouse click, the click-down event triggers an immediate scroll, which also creates an unintended text selection (as if the user were holding the mouse button while scrolling).

Notes:

  • The issue persists with --disable-extensions (but built-in Markdown extension is still active).
  • The following settings do NOT fix it:
    • "markdown.preview.scrollPreviewWithEditor": false
    • "markdown.preview.scrollEditorWithPreview": false
    • code --user-data-dir "$env:TEMP\vscode-clean-test" --disable-extensions to create a window with clean profile
  • The "locked" position is essentially the source line that was at the top of the preview when togglePreview was last used to exit preview mode. The editor remains bound to that scroll position until the next reload, even after manually scrolling away.

Metadata

Metadata

Assignees

Labels

new releaseIssues found in a recent release of VS Code

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions