Page MenuHomePhabricator

"Cannot read property 'findParent' of undefined" when editing a table (but editing the table works correctly)
Closed, ResolvedPublic

Description

Insert the following table (found in https://en.wikipedia.org/wiki/Timeline_of_the_Apple_II_family

{| class="wikitable"
| style="width:40px;vertical-align:top" rowspan="4" |'''1977''' || style="width:100px" rowspan="4"| April 16 || style="width:230px" | [[Apple II]] || style="width:110px" | [[Apple II]] || style="width:130px" | January 1, 1981
|-
|}

The table is saved and displayed correctly.
Open in VE and click on the first or second cell - the following Console error is displayed:

Uncaught TypeError: Cannot read property 'findParent' of undefined
    at VeDmTableSelection.ve.dm.TableSelection.isMergeable 
    at VeUiMergeCellsContextItem.ve.ui.MergeCellsContextItem.setup 
    at VeUiDesktopContext.ve.ui.Context.setupMenuItems     
    at VeUiDesktopContext.ve.ui.Context.toggleMenu 
    at VeUiDesktopContext.ve.ui.LinearContext.afterContextChange 
    at VeUiDesktopContext.ve.ui.DesktopContext.afterContextChange

Screen Shot 2018-04-09 at 2.03.51 PM.png (618×996 px, 152 KB)

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Esanders subscribed.

That is definitely very broken table syntax, but ideally we wouldn't throw an exception.

Deskana renamed this task from "Cannot read property 'findParent' of undefined" when editing a table to "Cannot read property 'findParent' of undefined" when editing a table (but editing the table works correctly).Apr 10 2018, 6:44 PM

The table is still editable, despite this exception being thrown.

As an aside, the tables also don't display properly in read mode in Firefox. These are very bad tables.

Screen Shot 2018-04-10 at 19.45.49.png (536×1 px, 111 KB)

Deskana lowered the priority of this task from Low to Lowest.Apr 11 2018, 9:56 AM

This is absolute lowest priority—it's definitely valid issue, but it doesn't affect core functionality and it only happens if someone does something really wrong with the table.

Change 623858 had a related patch set uploaded (by Esanders; owner: Esanders):
[VisualEditor/VisualEditor@master] Handle tables with rowspans that exceed the matrix

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

Esanders moved this task from Freezer to Triaged on the VisualEditor board.
Esanders moved this task from Incoming to Code Review on the Editing-team (Kanban Board) board.

Change 623858 merged by jenkins-bot:
[VisualEditor/VisualEditor@master] Handle tables with rowspans that exceed the matrix

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

Change 628205 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (1c3ca2da9)

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

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

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

matmarex moved this task from Code Review to QA on the Editing-team (Kanban Board) board.
matmarex subscribed.

Reduced test case for QA: https://en.wikipedia.beta.wmflabs.org/wiki/T191858

{| class="wikitable"
|rowspan="3"| A
| B
| C
|}

The first cell in this table is defined to span 3 rows, but the table has only 1 row.

Before the patch, selecting the first cell immediately caused an error, and choosing (row menu)Insert below did nothing (and caused another error). Various other table operations also failed.

After the patch, there should be no errors. There's one known issue (we're not planning to work on it): "Inserting a new row doesn't quite work as expected, because it relies on the last row in the matrix to be correctly formed, but one can use the placeholder buttons to fix the newly inserted row, and no exceptions are thrown, so this is good enough for now."

image.png (155×235 px, 2 KB) image.png (155×235 px, 2 KB) image.png (155×235 px, 4 KB) image.png (155×235 px, 4 KB)