Background
CodeMirror + the 2017 wikitext editor can sometimes result in misalignment issues between the VE surface and the CodeMirror surface, which seriously disrupts the editing experience. See these current and previous tasks:
- T357482: 2017 wikitext editor integration in CodeMirror 6 (examples in comments)
- T373649: Copying and pasting large pages causes misalignment between CodeMirror and VE surfaces
- T212680: Cursor off by several lines where the text is edited in new wikitext mode
- T197592: Text selection is offset one line from cursor location
- T365008: Typing causes text to appear below cursor
- T252965: The cursor of New wikitext mode moves wrongly in Chinese Wikipedia.
We should devise a means to automatically detect this issue and report it, so that we can better understand which environments it occurs in and fix it accordingly.
Acceptance criteria
When transactions are made in the 2017 editor, attempt to detect any misalignment, such as:
- Compare the computed height between the VE surface and the CodeMirror surface
- Compare offset of a row of text in VE and a row in CodeMirror
If we detect misalignment, log this with either:
- mw.errorLogger which will surface in Grafana (see also T373710)
- Throw an actual exception so that it's recorded in logstash
If it happens repeatedly, CodeMirror should automatically be disabled, and notify the user of such through a bubble notification (mw.notify).