Steps to replicate the issue (include links if applicable):
- Go to https://en.wikipedia.beta.wmflabs.org/wiki/Fox?veaction=editsource and have CodeMirror enabled
- Hit ⌃+A to select all content
- Hit ⌃+X to cut it
- Hit ⌃+P to paste it back
What happens?:
- Scroll down and observe the content is outside the editing area (because CodeMirror and VE surfaces are misaligned)
- You can also run $(".ve-ce-documentNode-codeEditor-webkit-hide").css('-webkit-text-fill-color', 'black'); in your JS console to more clearly see the misalignment
What should have happened instead?:
There should be no misalignment.
Other information
I think this is because the change in gutter width isn't being accounted for. This should be fixable.
Note this only effects CodeMirror 6, which as of the time of writing is only rolled out on mediawiki.org and the Beta cluster.
Derived Requirement
Ensure there is no misalignment between the CodeMirror and VisualEditor (VE) surfaces when performing content cut and paste actions in CodeMirror 6 on MediaWiki pages.
BDD
Feature: Consistent Alignment Between CodeMirror and VisualEditor Surfaces
Scenario: Ensure no misalignment between CodeMirror and VE surfaces after content cut and paste
Given the user has CodeMirror 6 enabled on a MediaWiki page using the VisualEditor When the user selects all content, cuts it, and pastes it back Then the CodeMirror and VE surfaces should remain aligned without content being rendered outside the editing area
Test Steps
Test Case 1: Ensure No Misalignment Between CodeMirror and VE Surfaces After Cut and Paste
Navigate to this page with CodeMirror 6 enabled.
Press Ctrl + A (Windows) or Cmd + A (macOS) to select all content.
Press Ctrl + X (Windows) or Cmd + X (macOS) to cut the selected content.
Press Ctrl + V (Windows) or Cmd + V (macOS) to paste the content back into the editor.
Scroll down and observe the alignment of the content within the editing area.
✅❓❌⬜ AC1: Confirm that the content remains within the editing area, and there is no misalignment between the CodeMirror and VE surfaces.
Optionally, run the following in the JS console to make the misalignment more visible:
$(".ve-ce-documentNode-codeEditor-webkit-hide").css('-webkit-text-fill-color', 'black');.
QA Results - Beta
| AC | Status | Details |
|---|---|---|
| 1 | ✅ | T373649#10304996 |







