[lexical-table] Bug Fix: Improve nested table selection by using monolithic pointer event handling#8193
Conversation
…-level pointerDown, and select the right table
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
|
||
| return mergeRegister( | ||
| registerWindowHandlers(), | ||
| registerTableWindowHandlers(editor, tableSelections), |
There was a problem hiding this comment.
This is leaking the Map of TableObservers out, but felt better than putting a bunch of selection-specific code into LexicalTablePluginHelpers. Perhaps a better way would to pass down a TableObservers class that limits the exposure?
There was a problem hiding this comment.
I think it's fine for internal implementation details to leak across the implementation, it's not part of the API
etrepum
left a comment
There was a problem hiding this comment.
I didn't look super closely at every change but it looks like a straightforward refactor and should be fine to merge assuming all tests are passing
|
|
||
| return mergeRegister( | ||
| registerWindowHandlers(), | ||
| registerTableWindowHandlers(editor, tableSelections), |
There was a problem hiding this comment.
I think it's fine for internal implementation details to leak across the implementation, it's not part of the API
|
GitHub actions are currently broken so I will have to check back in later |
Description
Continuation of #8187.
Previously, clicking a nested table would result in each table firing its own pointerDown handler, and also register their own window.onPointerMove handlers, resulting in difficulty clicking on any cells in nested tables (see "Before").
This PR moves to register just a single pointerDown event for all tables (and associated onPointerMove/onPointerUp). Now these handlers only run against the deepest relevant table.
This is not the final PR in this series. Some additional handling is needed to correctly exit
isHighlightingCellsmode, as well as handle dragging between inner-table cells and the parent.Currently no new E2E tests because the previous behaviour is quite hard to test reliably.
Test plan
Before
Observe that clicking and dragging on cells in nested tables often results in the parent table being selected as well (because its onPointerMove handler is firing as well)
Screen.Recording.2026-03-05.at.6.45.52.pm.mov
After
Screen.Recording.2026-03-05.at.6.46.11.pm.mov