Page MenuHomePhabricator

WikiEditor scrolls textbox to the first line and removes focus
Closed, ResolvedPublic

Description

mediawiki.action.edit tries hard to preserve the scrollTop property of the textbox after submitting the form for preview, but WikiEditor seems to try to prevent that.

Steps to reproduce:

  1. Open a long article for editing, scroll down a bit.
  2. Hit preview (make sure you don't use LivePreview).
  3. When your computer is slow enough, focus the textarea before WikiEditor loads.
  4. Wait for WikiEditor to initialize.

Expected result:
The text is scrolled down a bit (as you left it before the preview), the focus is still in the textarea (if you focused it in step 3).

Actual result:
The text starts at the beginning, the focus is lost.

This happens in jquery.wikiEditor.js in line 502: $textarea.wrapAll() seems to reset the scrollTop property of the textbox as well as it removes the focus, at least in Firefox and Internet Explorer.

The scrollTop property and the fact that the textarea is focused should be saved before the WikiEditor structure is built in the DOM and restored afterwards.


Version: unspecified
Severity: normal

Details

Reference
bz41911

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 12:51 AM
bzimport set Reference to bz41911.
bzimport added a subscriber: Unknown Object (MLST).

This is always reproducible, I assume?

Change 124567 had a related patch set uploaded by TheDJ:
Preserve textarea state when building WikiEditor UI

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

  • Bug 31506 has been marked as a duplicate of this bug. ***

Change 124567 merged by jenkins-bot:
Preserve textarea state when building WikiEditor UI

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