Page MenuHomePhabricator

Editor crashes when removing selected words to join two paragraphs
Open, Needs TriagePublic

Description

  1. Open https://www.mediawiki.org/w/index.php?title=Project:Sandbox&oldid=6126303&veaction=edit
  2. Place cursor after the word "but" and insert a line break by pressing Enter.
  3. Select across the two sentences and press Backspace to delete these words.

Screenshot 2023-09-27 at 20.02.39.png (417×1 px, 58 KB)

Other notes

Firefox 117, macOS, logged-in.

Originally found while editing https://en.wikipedia.org/wiki/Progressive_enhancement on English Wikipedia, and realized the editor had crashed resulting in various internal inconsistencies.

Uncaught Error: Cannot add a child to text node
    checkCanInsertNodeType ve.dm.TreeModifier.js:1134
    pushMoveNodeOp ve.dm.TreeModifier.js:804
    processRetain ve.dm.TreeModifier.js:600
    processLinearOperation ve.dm.TreeModifier.js:441
    calculateTreeOperations ve.dm.TreeModifier.js:425
    process ve.dm.TreeModifier.js:391
    process ve.dm.TransactionProcessor.js:110
    commit ve.dm.Document.js:385
    changeInternal ve.dm.Surface.js:994
    change ve.dm.Surface.js:962
    change ve.dm.SurfaceFragment.js:125
    delete ve.dm.SurfaceFragment.js:971
    execute ve.ce.LinearDeleteKeyDownHandler.js:291
    executeHandlersForKey ve.ce.KeyDownHandlerFactory.js:99
    onDocumentKeyDown ve.ce.Surface.js:1602
    callListener ve.EventSequencer.js:432
    onEvent ve.EventSequencer.js:262
    makeEventHandler ve.EventSequencer.js:65

Event Timeline

Some application of git bisect suggests that this may be another lingering bit of fallout from T215567's https://gerrit.wikimedia.org/r/c/VisualEditor/VisualEditor/+/473380/. (I.e. it's a regression, but it's been broken in this way since 2019.)

The key element to reproduce it is joining two paragraphs by deleting a selected range of text when the later paragraph contains an alien node of some sort. It's easily done on the standalone VE aliens demo -- the image sample is also convenient.