VisualEditor: Up/down arrow in Firefox broken after using left/right
Open, NormalPublic


  1. place cursor in large body of text in FF
  2. Cursor up then down, everything is fine
  3. Cursor right a dozen or so times, then up

Then cursor jumps up and left to the same place it was after (2).

Initial investigations show that disabling handling of up/down arrows makes no difference, but disabling handling of left/right does fix, so probably something to do with the surfaceObserver state?

Version: unspecified
Severity: major
See Also:


bzimport raised the priority of this task from to Normal.
bzimport set Reference to bz70724.
Esanders created this task.Sep 11 2014, 5:29 PM

Looks like a browser bug with Firefox's native selection having inconsistent state. I'm going to try poking some more at this tomorrow and maybe file some upstream bugs.

Minimal test case:

(This will throw errors in some edge cases, but that's not the point; try arrowing around near the middle of the text.)

Calling nativeSelection.collapseToStart() seems to magically fix the erroneous behavior (, we can probably use that as a workaround for selections that are already collapsed.

(I see no neat way to fix non-collapsed ones; randomly calling some other Selection methods might help, but they probably won't be no-ops. These are a smaller problem anyway and can wait for Firefox to fix their bug.)

I'm filing this upstream.

gerritadmin wrote:

Change 164162 had a related patch set uploaded by Bartosz Dziewoński:
ve.ce.Surface: Magic workaround for broken Firefox cursoring

gerritadmin wrote:

Change 164162 merged by jenkins-bot:
ve.ce.Surface: Magic workaround for broken Firefox cursoring

More "worked around" than actually fixed, but…

Workaround reverted, caused bug 71580 (ugly-looking "NS_ERROR_FAILURE" exceptions in some cases).

Possibly not anything we can actually fix…