-
Notifications
You must be signed in to change notification settings - Fork 442
Description
Bug report
Packages affected
- sandpack-client
- sandpack-react
Description of the problem
The following props in the SandpackCodeEditor component do not work together as expected:
showLineNumbersreadOnly
When the readOnly prop is set to true, the line numbers disappear, even if showLineNumbers is explicitly enabled.
This issue appears to have started after version 2.19.10.
✅ Working in v2.19.10
Line numbers visible in editable mode
✅ In v2.19.10,
readOnlyworks withshowLineNumbers(note: no visual read-only indicator)
❌ Broken in v2.19.11 and later
❌ In read-only mode, line numbers disappear
From
v2.19.11onward, thereadOnlyindicator appears, but line numbers are hidden
🧪 Steps to Reproduce
- Use
SandpackCodeEditor - Set both
readOnly={true}andshowLineNumbers={true} - Observe that line numbers are hidden in read-only mode
✅ Expected Behavior
Line numbers should remain visible when readOnly is true if showLineNumbers is also true.
📌 Version Affected
- Works:
v2.19.10 - Broken:
v2.19.11and above
💡 Additional Notes
It seems that the bug was introduced in a refactor or update made in v2.19.11. Ideally, readOnly should not interfere with the showLineNumbers visibility toggle.



