Skip to content

fix: let double-click open a table cell again - #355

Merged
vibhavkatre merged 1 commit into
mainfrom
fix/table-cell-double-click-353-354
Aug 9, 2026
Merged

fix: let double-click open a table cell again#355
vibhavkatre merged 1 commit into
mainfrom
fix/table-cell-double-click-353-354

Conversation

@vibhavkatre

Copy link
Copy Markdown
Collaborator

Double-clicking a whiteboard table cell selected the table but never left a caret in it. Two separate faults were in the way — one on every document type, one specific to the unified canvas.

Closes #353
Closes #354

#353 — the editor was thrown away immediately after being opened

onDoubleClick did this:

ui.state.editingCell = { tableId, row, col }
ui.selectTable(table.id)

selectTable routes through setSelection, which clears editingCell by design — any selection change should close an open cell editor. So the second line discarded what the first had just set, on every double-click, including when the table was already selected.

Fixed by selecting first, then opening the cell. The clearing behaviour in setSelection is correct and is unchanged.

WhiteboardTable.vue's own header comment claimed double-click was the way in, so this read as intended behaviour that had silently stopped working.

#354 — on the unified canvas the handler was unreachable anyway

delegatesSurface() only delegates to the whiteboard layer for unambiguous whiteboard tools; select falls through to shared block handling. That is deliberate for pointer events, but it also gated onDoubleClick, so on a unified document the whiteboard's double-click never ran at all.

The cell lookup is now a small exported editTableCellAt(store, point), which DiagramCanvas calls directly for the unified case — after its own block-shape check, and only when a table is actually under the cursor.

That last part is deliberate: force-delegating the whole handler would also have brought the whiteboard's "double-click empty canvas creates a text box", which the unified canvas does not do today. There is a test pinning that.

Testing

842 vitest and 8 E2E (3 new), run against a real browser.

The new unit test goes through the real useWhiteboardUi singleton rather than the fake ui the neighbouring tests use, because the bug lived in the interaction between the two. I verified it fails against the old ordering:

× editTableCellAt > leaves the cell open after selecting the table
  → selecting the table cleared the cell it just opened: expected null to deeply equal { tableId: 'wte1d5', row: 1, col: 0 }

E2E covers double-click opening a cell on both a legacy whiteboard and a unified document, typing into it and asserting the persisted document, plus the guard that double-clicking empty unified canvas still creates nothing.

🤖 Generated with Claude Code

Two separate faults meant double-clicking a table cell never left a caret
in it, on any document type.

`onDoubleClick` set `editingCell` and then called `selectTable`. That
routes through `setSelection`, which clears `editingCell` by design, so
the second line threw away what the first had just set — on every
double-click, including when the table was already selected. Selecting
first fixes it; the clearing behaviour is correct and stays.

On the unified canvas the handler was unreachable regardless: only
whiteboard TOOLS delegate surface events there, so the select tool never
reached the whiteboard layer at all. The cell lookup is now a small
exported function that DiagramCanvas calls directly for that case, after
its own block-shape check and only when a table is actually under the
cursor — so double-clicking empty unified canvas still does nothing
rather than gaining the whiteboard's double-click-makes-a-text-box.

Closes #353
Closes #354

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@vibhavkatre
vibhavkatre merged commit 1e1b11f into main Aug 9, 2026
3 checks passed
@vibhavkatre
vibhavkatre deleted the fix/table-cell-double-click-353-354 branch August 9, 2026 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unified canvas: whiteboard objects never receive double-click (table cells unreachable) Double-clicking a table cell never opens it for editing

2 participants