Open
Bug 1490667
Opened 7 years ago
Updated 3 years ago
Goal column for vertical cursor motion gets confused by programmatic selection changes
Categories
(Core :: DOM: Editor, defect, P3)
Core
DOM: Editor
Tracking
()
NEW
People
(Reporter: marijnh, Unassigned)
Details
Attachments
(2 files)
I'm not sure if goal column is the term used internally in Gecko, but I mean the feature where vertically moving the cursor across short lines will, after you get back on a long line, put you back at/near your original horizontal offset.
This requires some hidden state, and it seems maintaining that hidden state goes wrong when the selection is set from JavaScript—subsequent arrow up/down motions go back to an old horizontal position, and seem to ignore the position of the programmatically set selection.
The attached HTML file contains detailed reproduction instructions. But the basic thing you have to do is move vertically (arrow up/down), then set the selection from JavaScript, and then move vertically again. The horizontal offset will correspond to the last vertical motion done directly by the user. Other browsers do not behave this way, and it seems like using the _current_ selection position is more likely to be what people expect to be used here.
Reporter | ||
Comment 1•7 years ago
|
||
Oh, plot twist, it seems that this only happens when `Selection.addRange` is used, not `Selection.collapse`, and I uploaded the wrong version of the reproduction example file. Use the second attached file to actually see the issue.
Reporter | ||
Comment 2•7 years ago
|
||
Reporter | ||
Comment 3•7 years ago
|
||
Relatedly, calling `getSelection().modify("move", "forward", "line")` multiple times in a row does not result in goal-column-aware motion, since apparently there the goal _is_ reset (incorrectly—it should be preserved during line motion) on every update.
Comment 4•7 years ago
|
||
Hi Marijn,
I've tested and I can reproduce your issue on the latest builds from Nightly 64(20180916220033), Beta 63(20180913141435) and Release 62(20180830143136) channels.
Environments covered: MacOs 10.12, Win10 x64, Win7 x64
Thanks for reporting!
status-firefox62:
--- → affected
status-firefox63:
--- → affected
status-firefox64:
--- → affected
Component: Untriaged → Document Navigation
Product: Firefox → Core
Updated•7 years ago
|
Component: Document Navigation → Editor
Comment 5•7 years ago
|
||
caret behaviour is layout/generic/nsFrameSelection.cpp that isn't editor.... But it keeps editor component for this bug....
Priority: -- → P3
Updated•3 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•