SplitPane: collapse state + onCollapse double-click#25
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 395c59f277
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| this.splitPaneLastDividerDown = Object.freeze({ | ||
| id, | ||
| dividerIndex: i, | ||
| timeMs: event.timeMs, | ||
| }); |
There was a problem hiding this comment.
Clear divider double-click state before starting a drag
This records a double-click candidate on every divider mouse-down, but that state is not cleared when the interaction turns into a drag, so a quick second resize attempt on the same divider (within 500ms) is interpreted as a double-click and fires onCollapse unexpectedly. In collapsible panes this causes unintended panel collapse during rapid consecutive drag adjustments; the double-click tracker should be invalidated on drag/mouse-up or armed only for click-like interactions.
Useful? React with 👍 / 👎.
| if (delta <= 0) { | ||
| out[idx] = minSize; |
There was a problem hiding this comment.
Keep collapsed panels within the available panel budget
When constraints are tight (sum(minSizes) > available), panel sizing can intentionally push a panel below its min to stay within bounds, but this branch always bumps collapsed panels back up to minSize without shrinking another panel. In that case total panel cells can exceed available space (e.g. available=20, minSizes=[15,15], collapsed panel at index 1), causing child rects to overflow the container and desynchronize divider rendering/hit-testing from the actual viewport.
Useful? React with 👍 / 👎.
- Apply collapsed indices in layout (collapse to minSizes) - Add double-click divider routing to invoke onCollapse - Fix divider hit testing/rendering to use panel boundaries
395c59f to
61e8a08
Compare
Fixes P1 API inconsistency: SplitPane collapsible/collapsed/onCollapse were documented/typed but unused.
Changes:
collapsedindices whencollapsible: true(collapsed panels clamp tominSizes[index]or 0).onCollapse(index, collapsed)(click left/top vs right/bottom to choose panel).Tests:
Note: npm run test:e2e is linux-only by design.