CodeMirror request body renders large blank gaps due to .cm-content { max-height: 20px }
Author: MiroKovCreated Oct 1, 2026Updated Oct 1, 2026
Labelsbug
What happens?
When displaying/editing a larger JSON request body in the Scalar API Reference, large blank gaps appear between lines in the CodeMirror editor.
Inspecting the DOM shows that CodeMirror inserts large .cm-gap elements. Clicking different lines can cause the gap to move and different parts of the document to render.
I traced the issue to a Scalar scoped CSS rule:
[data-v-dbc85839] .cm-content { max-height: 20px; }
How can we reproduce the issue?
- Use Scalar.AspNetCore 2.17.7.
- Open an operation with a relatively large JSON request body/example.
- Open the request body editor.
- Scroll through the JSON and/or click lines further down in the document.
- Large blank areas appear between lines.
- Inspect .cm-content.
In the broken state I observed:
.cm-content bounding height: 20px .cm-content scrollHeight: 3880px .cm-editor height: 3888px .cm-scroller height: 3888pxCodeMirror also generates .cm-gap elements, sometimes several thousand pixels high. Setting:.cm-content { max-height: none !important; }makes the request body render normally.
What did you expect to happen?
The CodeMirror request body should render all lines at their normal positions without large virtualization gaps.
Environment
- Scalar.AspNetCore: 2.17.7
- ASP.NET Core
- Browser: [put Brave/Chrome version here]
- Large JSON request example loaded into the request body editor
- The problem persists through EditorView.requestMeasure() and browser resize.
- No CSS transform, scale, or zoom is applied to the editor ancestors.
- Browser zoom: 100%
OpenAPI Document
No response
Source: scalar/scalar