Page MenuHomePhabricator

Automatically detect and report misalignment between VE and CodeMirror surfaces
Open, Needs TriagePublic

Description

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:

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).

Related Objects

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Apologies for the late update. I attempted this a while back, and I ran into race conditions that led to a lot of false positives. I spent quite some time on it before having to abandon that route, and I haven't gotten back around to this task yet. I might try using a ResizeObserver next, maybe that will be more reliable. Fortunately a lot of the issues we were seeing before have been resolved. There are still outliers where the alignment is off, just as before, but it's much better now.