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

Description

  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:
https://bugzilla.mozilla.org/show_bug.cgi?id=1075901

Details

Reference
bz70724
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: http://jsfiddle.net/ybawstce/1/

(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 (http://jsfiddle.net/ybawstce/3/), 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

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

gerritadmin wrote:

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

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

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…