Page MenuHomePhabricator

CodeMirror textarea scrolls back to top in IE with CodeMirror enabled
Open, NormalPublic5 Story PointsBug

Description

Steps to reproduce:

  1. Open an article in VE and scroll down
  2. Click somewhere in the article body
  3. In 2010 editor you get scrolled right back to the top of the article however the cursor stays where you clicked.
  4. In 2017 editor similar behavior occurs however it's not as predictable - click around a bit/hit enter and you get scrolled to the top at some point.

Problem does not occur in Edge.


I went to Internet Explorer 11 and found a huge problem while editing a page in "Syntax Highlighting" feature. I tried to edit a long page in that mode, like an article about the letter "V".

At 2010 WikiEditor (Enhanced Toolbar enabled), I scrolled down the page and clicked on the editing window. Unfortunately, the editing window sent me straight back up to the beginning of the page.

I disabled the Toolbar(s) to try this out in 2003 WikiEditor (one without toolbars) and 2006 WikiEditor (one with old-school toolbar). I tested out the page in those WikiEditors. The issue is the same in those WikiEditors.

This applies to only Internet Explorer version(s), I think.

Event Timeline

gh87 created this task.Mar 26 2018, 1:00 PM
Restricted Application added a project: Community-Tech. · View Herald TranscriptMar 26 2018, 1:00 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
gh87 updated the task description. (Show Details)Mar 26 2018, 1:06 PM

@gh87 Were you able to edit the page though?

gh87 added a comment.Mar 27 2018, 11:58 PM

I thought I could edit only the top of the source code.

Indeed, if I scroll down the window and then click on the content, the page still goes back up. However, I pressed PageUp or PageDown and any other keys, and I can type anything.

If I were to continue using the mode in IE11, I would rely more on a keyboard to scroll down and then type anything. Otherwise, if I click the editing window with a mouse, the page goes back up to the beginning, so I have to use the PageDown to go back to where I left off.

Also, I found out that performing either Ctrl+X or Ctrl+C might be okay. However, once I perform the Ctrl+V, the content won't break a line.

I can confirm this bug on IE11. Steps to reproduce:

  1. Open a random article in WikiEditor with syntax highlighting enabled
  2. Scroll down and click somewhere in the article text body.
  3. The texture immediately scrolls back up to the top but your cursor remains at the place you clicked.
  4. Hit enter/and or start to type, you get scrolled back to the place you were at.

I could not reproduce this behavior in Edge but I saw a somewhat different bug in Edge where the cursor moves to the beginning of the article window. I'll file a task for it.

Niharika renamed this task from In pre-2017 WikiEditors, sent back to beginning of a page after clicking on the editing window while scrolled down in "syntax highlighting" mode in Internet Explorer to CodeMirror textarea scrolls back to top in IE with CodeMirror enabled.Mar 29 2018, 9:57 PM
Niharika triaged this task as Normal priority.
Niharika updated the task description. (Show Details)
Niharika renamed this task from CodeMirror textarea scrolls back to top in IE with CodeMirror enabled to CodeMirror textarea scrolls back to top in IE and Edge with CodeMirror enabled.Apr 10 2018, 9:20 PM
TBolliger set the point value for this task to 5.
MusikAnimal added a subscriber: MusikAnimal.EditedApr 12 2018, 10:05 PM

Regarding Edge, we've got conflicting reports here. The task title says "IE and Edge", but the description says "Problem does not occur in Edge". Is Edge supposed to be affected or not?

I tried it out myself, and I could only reproduce the "textarea scrolls back to top" in IE, not Edge.

I saw a somewhat different bug in Edge where the cursor moves to the beginning of the article window. I'll file a task for it.

I couldn't repro this either. I'm using Windows 10.

TBolliger renamed this task from CodeMirror textarea scrolls back to top in IE and Edge with CodeMirror enabled to CodeMirror textarea scrolls back to top in IE with CodeMirror enabled.Apr 12 2018, 11:49 PM

It looks like Niharika opened a separate task (T191093) then merged them.

Either we need to fix this for IE11 or we should disable CodeMirror on IE11 for all editors (2017, 2010, and 2006).

MusikAnimal added a comment.EditedMay 4 2018, 4:13 PM

I think I can confirm this is not a bug in CodeMirror, so to speak. CodeMirror as you may know reimplements everything the browser does natively, including scrolling. If I add a bunch of logging to the code, I can see it is setting the correct value for the scroll position when you click in the textarea, then those same methods get called again but with a value of 0 (because there's also a scroll event listener). That tells me CodeMirror is at least trying to do the right thing. Why IE jumps you to the top I still don't know :(

I should mention that although the scroll position gets reset, the cursor is still in the right place. Once you start typing the scroll position goes back to where the cursor is. Annoying, yes, but it is at least functional.

I don't have a windows machine or environment handy so I can't easily test this — the purpose of this ticket is to make the behavior of the editor the exact same with CodeMirror as it is without CodeMirror.

Due to the difficulty of these defects, the minimal usage of IE, and the fact this is an opt-in feature, the Community Tech team will not be fixing any more IE bugs for CodeMirror.