Page MenuHomePhabricator

Select all throws an exception (recent regression)
Closed, ResolvedPublic8 Estimated Story Points

Description

Steps to reproduce:

  1. In VE standalone, edit a<!----><dl></dl>
  2. Open the debugger, then click to put the selection beside the 'a'.
  3. Press Ctrl+A

Expected behaviour: Whole document is selected
Actual behaviour: Exception is thrown because the DOM selection leaks one text character beyond the ve-ce-surface div (into the ve-ui-debugBar-selectionLabel).

This is because the empty comment creates a { type: 'commentMeta' } node, whose outer length in the DM getNodeAndOffset doesn't count properly (because it has no corresponding DOM node).

This has regressed since the metadata patch: https://gerrit.wikimedia.org/r/#/c/385492/ - before that, meta items did not have an outer length.

Event Timeline

Ooh, interesting. Minimal case for throwing the error:

  1. Edit a<!----><dl></dl>
  2. Press Ctrl+A

Expected behaviour: Whole document is selected
Actual behaviour: Exception is thrown because the DOM selection leaks one text character beyond the ve-ce-surface div (into the ve-ui-debugBar-selectionLabel).

This is because the empty comment creates a { type: 'commentMeta' } node, whose width getNodeAndOffset doesn't count properly because it has no corresponding DOM node.

Change 408236 had a related patch set uploaded (by Divec; owner: Divec):
[VisualEditor/VisualEditor@master] WIP: Fix getNodeAndOffset for MetaItems

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

Change 408236 merged by jenkins-bot:
[VisualEditor/VisualEditor@master] Fix getNodeAndOffset for MetaItems

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

Change 409632 had a related patch set uploaded (by Jforrester; owner: Jforrester):
[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (c39a4a69b)

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

Change 409632 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (c39a4a69b)

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

Jdforrester-WMF assigned this task to dchan.
Jdforrester-WMF triaged this task as High priority.
Jdforrester-WMF moved this task from To Triage to TR0: Interrupt on the VisualEditor board.
Jdforrester-WMF set the point value for this task to 8.