VisualEditor: Putting cursor after reference list throws "offset was inside a handlesOwnChildren node" error
Closed, ResolvedPublic



  1. Open
  2. Scroll to bottom
  3. Place cursor in slug between gallery and references list
  4. Cursor right twice

Expected outcome: Cursor ends up in slug at end of the page after the references list

Actual outcome: Error thrown: "offset was inside a handlesOwnChildren node"

Version: unspecified
Severity: normal

bzimport set Reference to bz68588.
Jdforrester-WMF created this task.Via LegacyJul 25 2014, 8:58 PM
Catrope added a comment.Via ConduitJul 28 2014, 7:21 PM

This doesn't seem to be related to focusable nodes or the end of the document. All you need to do is put the cursor in a block slug after a references list.

Suppose the references list is at (23,25). What happens is this:

  • setSelection (25,25) is called
  • It tries to compute insertion annotations by pulling from the left
  • It does so by calling getNearestContentOffset( 24, -1 )
  • Two stack levels deeper, getRelativeOffset() notices that 24 is inside of a handlesOwnChildren node and throws an exception


  • Why is reference list a handlesOwnChildren node? Is it because <ref> can be nested inside of <references>?
  • Why do we do offset-1 here? There is a Math.max() to guard against ending up at -1, but this bug uncovers another reason why subtracting one from an offset is dangerous and should ideally never be done
gerritbot added a comment.Via ConduitAug 20 2014, 1:56 PM

Change 155260 had a related patch set uploaded by Esanders:
Fix check for left/right annotations

gerritbot added a comment.Via ConduitAug 20 2014, 5:55 PM

Change 155260 merged by jenkins-bot:
Fix check for left/right annotations

Add Comment

Column Prototype
This is a very early prototype of a persistent column. It is not expected to work yet, and leaving it open will activate other new features which will break things. Press "\" (backslash) on your keyboard to close it now.