Changing container width with code folding enabled results in broken selection

Author: markocikosCreated Apr 1, 2026Updated Apr 1, 2026

Steps to reproduce:

  1. Go to https://codemirror.net/5/demo/folding.html
  2. In dev tools, set container width to a fixed value, for example 300px.

Expected behavior: selection within editable area works normally.

What actually happens: you can select blank areas, set cursor to blank area.

Image