Page MenuHomePhabricator

Linter highlight is removed when realtime preview loads
Closed, ResolvedPublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):

  • enable realtime preview
  • follow an edit link with a valid lintid (e.g. by clicking one of the edit links on Special:LintErrors)

What happens?:
The wikitext editor area loads with the appropriate part of the wikitext pre-selected; then the highlighting disappears when the preview shows up.

What should have happened instead?:
Loading the preview should not affect text selection.

Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc.:
Seen on a Wikimedia wiki in Chrome 102.

Event Timeline

Change 809147 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/extensions/WikiEditor@master] Realtime Preview: prevent lose of textarea selection when toggling

https://gerrit.wikimedia.org/r/809147

Good find!

This happens whenever any text is selected in the textarea and the preview pane is toggled on or off.

Thanks for acting so quick on this Sam, definitely the right call to move it into sprint

Change 809147 merged by jenkins-bot:

[mediawiki/extensions/WikiEditor@master] Realtime Preview: prevent lose of textarea selection when toggling

https://gerrit.wikimedia.org/r/809147

@Samwilson I guess you will also need to fix this bug in CodeMirror? The highlighting still gets removed there when opening/closing RTP.

Change 815203 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/extensions/WikiEditor@master] Realtime Preview: track focus via events rather than jQuery

https://gerrit.wikimedia.org/r/815203

Change 815203 abandoned by Samwilson:

[mediawiki/extensions/WikiEditor@master] Realtime Preview: track focus via events rather than jQuery

Reason:

This is done much more cleanly by MusikAnimal in I377fb3a122cda360e016716e3beb9c34983b8e10

https://gerrit.wikimedia.org/r/815203

The fix for T311684 fixes things for CodeMirror with this bug as well.

The highlighting is now preserved when the editing page is first opened, and when you open and close the RTP pane.

The editing pane does not always scroll to the highlighted text on Chrome or Safari when opening/closing RTP. Further discussion of this can happen in T311684#8097126.

I tested with and without CodeMirror turned on.

Test environment: https://en.wikipedia.beta.wmflabs.org WikiEditor 0.5.3 (8ae9eff) 16:31, 21 July 2022.
Skins: Vector 2022, Vector 2010, Minerva, Timeless, MonoBook.
Browsers: Firefox 91, Chromium 87, Safari 15.