vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Scroll issues in markdown with mermaid

Open Andresit1524 opened this issue 6 months ago • 10 comments

Type: Bug

  1. Open a markdown file with its preview
  2. Write and add some mermaid diagrams

The document's scroll jumps between the cursor and the beginning of the file and it doesn't allow to write properly. Only happens with the preview active

Edit: mermaid preview should be the cause. Markdown with no diagrams works fine

VS Code version: Code 1.121.0 (f6cfa2ea2403534de03f069bdf160d06451ed282, 2026-05-19T11:51:53+02:00) OS version: Windows_NT x64 10.0.26200 Modes:

System Info
Item Value
CPUs AMD Ryzen 7 7730U with Radeon Graphics (16 x 1996)
GPU Status 2d_canvas: enabled
GPU0: VENDOR= 0x1002, DEVICE=0x15e7 [AMD Radeon (TM) Graphics], DRIVER_VENDOR=AMD, DRIVER_VERSION=31.0.21916.5001 ACTIVE
GPU1: VENDOR= 0x1414, DEVICE=0x008c [Microsoft Basic Render Driver], DRIVER_VERSION=10.0.26100.8328
Machine model name:
Machine model version:
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
trees_in_viz: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 15.40GB (5.62GB free)
Process Argv . --disable-extensions --crash-reporter-id 1c1093ea-1878-4d14-a959-3eb95aed77ce
Screen Reader no
VM 0%
Extensions (23)
Extension Author (truncated) Version
svgo 100 3.4.0
godot-files alf 0.1.8
easy-codesnap Art 1.37.4
vscode-translation cai 3.0.14
ruff cha 2026.44.0
path-intellisense chr 2.10.0
better-comments-next edw 3.4.9
godot-tools gee 2.6.1
geminicodeassist goo 2.82.0
dialogue-godot-support hak 0.3.5
language-julia jul 1.215.2
rainbow-csv mec 3.24.1
git-graph mhu 1.30.0
symbols mig 0.0.25
vscode-language-pack-es MS- 1.121.2026052214
debugpy ms- 2026.6.0
python ms- 2026.4.0
vscode-pylance ms- 2026.2.1
vscode-python-envs ms- 1.30.0
tinymist myr 0.14.18
pdf tom 1.2.2
errorlens use 3.28.0
markdown-all-in-one yzh 3.6.3
A/B Experiments
vsliv368cf:30146710
pythonvspyt551cf:31249601
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythonrdcb7:31342333
6518g693:31463988
aj953862:31281341
4f60g487:31327383
6abeh943:31336334
envsdeactivate2:31505458
cloudbuttont:31379625
3efgi100_wstrepl:31403338
bj468946:31457056
ec5jj548:31422691
cp_cls_c_966_ss:31454199
inlinechat_v2_hd992725:31505030
4je02754:31466945
c3h7c220:31478652
38bie571_auto:31426784
cp_cls_c_1081:31454833
conptydll_true:31498968
e9c30283:31461165
test_treatment2:31471001
c9b86496:31447327
idci7584:31464702
e3e4d672:31494082
ei9d7968:31496641
chat:31457767
7e187181:31503455
ghj88844:31499326
ddid_t:31478206
hmra_i5g22:31518061
getcmakediagnosticsoff:31489825
7df3h592:31512476
cp_cls_t_1082:31516087
logging_enabled_new:31498466
j0d79568:31499440
jb_cp_cls_c_632:31517842
852d2892:31506239
56dj4588:31512888
cg448276_tst_on:31514358
32d76977:31512328
ha629193:31508444
539gd155_c:31506875
jh5f2457_c:31515489
61138546:31518536

Andresit1524 avatar May 25 '26 23:05 Andresit1524

Example:

https://github.com/user-attachments/assets/39d47b66-f99f-489a-b561-4ce1641f94d3

Andresit1524 avatar May 25 '26 23:05 Andresit1524

it gets solved if I delete the first mermaid diagram, just discovered

Andresit1524 avatar May 25 '26 23:05 Andresit1524

Please share the text of that file

mjbvz avatar Jun 10 '26 21:06 mjbvz

Also does this reproduce in the latest VS Code insiders build with all extensions disabled?

mjbvz avatar Jun 10 '26 21:06 mjbvz

I’m experiencing a related (but slightly different) behavior that might help narrow this down.

Steps to reproduce on my side:

  1. Open a Markdown file with preview enabled
  2. Scroll down and click to focus on a line somewhere in the middle or in the end of the file
  3. Click outside the editor (lose focus)
  4. Click back inside the editor

Result: The editor scrolls upward unexpectedly, although the correct line (the one I clicked) remains selected.

Additional finding: After seeing the comment about Mermaid, I tried disabling the Markdown Preview Mermaid Support extension (bierner.markdown-mermaid), and the issue completely disappeared. Everything behaves normally with preview enabled once it’s disabled.

This suggests the problem may be related to how Mermaid diagrams interact with the preview scroll sync.

AhmedHafez13 avatar Jun 11 '26 14:06 AhmedHafez13

@mjbvz The file that caused the problem is this

Respect extensions, I tested the same file after disabling all extensions. Same problem.

I suspect the new integrated mermaid preview in VSCode is the cause

Details:

Version: 1.124.0 (user setup)
Commit: 1b50d58d73426c9171299ec4037d01365d995b78
Date: 2026-06-09T21:29:32-07:00
Electron: 42.2.0
ElectronBuildId: 14159160
Chromium: 148.0.7778.97
Node.js: 24.15.0
V8: 14.8.178.14-electron.0
OS: Windows_NT x64 10.0.26200

Andresit1524 avatar Jun 11 '26 16:06 Andresit1524

I encountered the same issue. Keep following up.

TwinklerG avatar Jun 27 '26 02:06 TwinklerG

i have this aissue als

AndresNamm avatar Jul 07 '26 05:07 AndresNamm

As I am facing this too, I changed the setting to turn off auto-scrolling of the editor.

"markdown.preview.scrollEditorWithPreview": false

jonahgraham avatar Oct 30 '26 18:10 jonahgraham

https://github.com/user-attachments/assets/24e0a6c9-0b0a-4e52-95c1-3956c740f22f

tested with another renderer: Pele, by an extension. Still failing

I´ll blame the markdown and how it handles the height of document when there are mermaid diagrams.

Probably the editor temporaly assumes height 0 for diagrams (when they recompile), generating this upward scroll? Just a hypothesis

Andresit1524 avatar Nov 17 '26 01:11 Andresit1524