Page MenuHomePhabricator

VisualEditor: Blanking the page using Ctrl-A and Delete keys prevents further editing in Firefox
Closed, ResolvedPublic

Description

To reproduce:

  • Edit a page with some existing content in VisualEditor.
  • Press Ctrl-A to select the whole text.
  • Press the Delete key.

Observed: The page cannot be edited any more.

Expected: The page doesn't have any text, but text can be added.


Version: unspecified
Severity: major

Details

Reference
bz50947

Event Timeline

Do any JS errors appear in the console while you do this?

Yes.

In RL debug mode I got this:

[11:13:55.789] TypeError: node.getParent(...) is null @ https://bits.wikimedia.org/static-1.22wmf8/extensions/VisualEditor/modules/ve/ce/ve.ce.Surface.js:1265

It only happens in Firefox.

  • Bug 50519 has been marked as a duplicate of this bug. ***
  • Bug 51169 has been marked as a duplicate of this bug. ***
  • Bug 52125 has been marked as a duplicate of this bug. ***

JohnCD67 wrote:

Occurs with Vector/Win7/FF23.0. It doesn't matter whether Ctr-A or Right-click/Select all is used, or whether "Delete" or "Backspace" is used to delete.

This is still happening with Firefox 24 on Linux using the monobook skin (other combinations not tested)

When the document loads in Firefox (Firefox 24, Mac) ve.ce.Document#getNodeAndOffset gets called with offset=1 to show initial selection (range: 1,1).

When selecting all and pressing backspace, ve.ce.Document#getNodeAndOffset gets called with offset = -1.

It gets there from ve.ce.Surface#handleDelete, which has a rangeToRemove (from this.model.getSelection) of 0,0.

The #handleDelete method then sees the range is collapsed, and since backspace=true, it will get a relative range on the document from the (collapsed) 0,0 rangeToRemove to -1.

Change 86299 had a related patch set uploaded by Krinkle:
ce.BranchNode: Insert slugs based on CE children length, not DM

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

This bug has been fixed somewhere in the past week. The range is no longer (0,0) but (0,[document length]). The document no longer crashes and properly deletes all content.

However this uncovered another bug, namely that in Firefox deleting the selection now leaves the document completely empty (not even a placeholder <p> to start typing again). That is what change 86299 (https://gerrit.wikimedia.org/r/86299) addresses.

However this bug is fixed, though I don't know which commit fixed it.

Change 86299 merged by jenkins-bot:
ce.BranchNode: Insert slugs based on CE children length, not DM

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