Page MenuHomePhabricator

Not scrolling to the lint error position when WikiEditor or CodeMirror is enabled
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

What happens?:

When both WikiEditor and CodeMirror are disabled, the textarea correctly scrolls to the error position. However, if either WikiEditor (except for Safari) or CodeMirror is enabled, the textarea does not scroll to the error position although the error range is selected.

A special case is opening the edit page with WikiEditor enabled and CodeMirror disabled using Safari. The textarea correctly scrolls to the error position. When clicking on the syntax highlighting button to enable CodeMirror, the textarea scrolls to the top again.

What should have happened instead?:

The textarea should always scroll to the error position.

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):

macOS Sonoma 14.8.1
Firefox 147.0.4
Chrome 145.0.7632.116
Edge 145.0.3800.70

Event Timeline

Change #1243626 had a related patch set uploaded (by Bhsd; author: Bhsd):

[mediawiki/extensions/Linter@master] Scroll the textbox to error location when WikiEditor is loaded

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

Change #1249037 had a related patch set uploaded (by MusikAnimal; author: MusikAnimal):

[mediawiki/extensions/CodeMirror@master] CodeMirror: store selection and focus state prior to initialization

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

The Linter patch is also needed, but:

When clicking on the syntax highlighting button to enable CodeMirror, the textarea scrolls to the top again.

I think this was a regression from us (err… I mean, me!) following r1108354. In my testing, the DOM manipulations mean the scroll position is lost by the time activeate() is called in CM. I made a quick patch to what I think works better. Sorry if I'm stepping on any toes! If you had a different solution in mind, or anything on the CM-side as part of this task, let me know and I'm happy to abandon my patch.

Change #1243626 merged by jenkins-bot:

[mediawiki/extensions/Linter@master] Scroll the textbox to error location when WikiEditor is loaded

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

MusikAnimal changed the task status from Open to In Progress.Mar 12 2026, 6:25 AM
MusikAnimal triaged this task as Medium priority.

Change #1249037 merged by jenkins-bot:

[mediawiki/extensions/CodeMirror@master] CodeMirror: store selection and focus state prior to initialization

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

Bhsd moved this task from Bugs to Done on the MediaWiki-extensions-CodeMirror board.
Bhsd updated Other Assignee, added: Bhsd.