Skip to content

revert(Tree): drop expandOnFolderClick#1142

Merged
tenphi merged 4 commits intomainfrom
fix-tree-event-handling
May 4, 2026
Merged

revert(Tree): drop expandOnFolderClick#1142
tenphi merged 4 commits intomainfrom
fix-tree-event-handling

Conversation

@tenphi
Copy link
Copy Markdown
Member

@tenphi tenphi commented May 4, 2026

Its row-level stopPropagation() on pointer/mouse events prevented document-level listeners from receiving them. Most visibly, Layout.Panel's resize (via React Aria's useMove) latched when the cursor released over a folder row in a Tree rendered inside a resizable panel (e.g. FilesEditor).

The default treegrid behavior (chevron expands, row activates selection) is unchanged.

Describe changes

Checklist

Before taking this PR from the draft, please, make sure you have done the following:

  • Pipeline is passed
  • Tests are added (including unit tests and stories in the storybook)
  • Tests are passed successfully
  • If you're adding a new component/new props, add stories that describe how this component/prop works
  • Changeset(s) is(are) added
  • You have passed the threshold of the library size
  • Commit message follows commit guidelines

Closes: N/A

Other information


Note

Medium Risk
Medium risk because it removes the public expandOnFolderClick prop (behavior/API change) and changes the forwarded ref target to a new inner scroll element, which may affect consumers relying on previous DOM structure.

Overview
Fixes Tree virtualization layout by moving scrolling into a new inner TreeScrollContainer, preventing the virtualizer sizer from being flex-shrunk and eliminating scroll viewport growth during re-measure.

Removes the expandOnFolderClick prop and all related event-interception logic/tests/docs/stories to restore default treegrid row activation behavior and avoid blocking document-level pointer/mouse listeners.

Updates ref-forwarding semantics so the forwarded ref now points to the inner scroll container (parent remains the role="treegrid" element), and adjusts tests accordingly.

Reviewed by Cursor Bugbot for commit 71f4d1f. Bugbot is set up for automated code reviews on this repo. Configure here.

Its row-level stopPropagation() on pointer/mouse events prevented
document-level listeners from receiving them. Most visibly, Layout.Panel's
resize (via React Aria's useMove) latched when the cursor released over a
folder row in a Tree rendered inside a resizable panel (e.g. FilesEditor).

The default treegrid behavior (chevron expands, row activates selection)
is unchanged.

Co-authored-by: Cursor <cursoragent@cursor.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cube-ui-kit Ready Ready Preview, Comment May 4, 2026 2:12pm

Request Review

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 4, 2026

🦋 Changeset detected

Latest commit: 71f4d1f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@cube-dev/ui-kit Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026

📦 NPM canary release

Deployed canary version 0.0.0-canary-615deed.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026

🧪 Storybook is successfully deployed!

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026

🏋️ Size limit report

Name Size Passed?
All 377.83 KB (-0.07% 🔽👏) Yes 🎉
Tree shaking (just a Button) 109.04 KB (0% 🟰) Yes 🎉

Click here if you want to find out what is changed in this build

The virtual sizer (`height: totalSize`) was applied directly to the
scroll element, so scrolling down made the viewport expand instead of
revealing more rows. Move the sizer to an inner wrapper so the outer
element stays a stable scroll viewport.

Co-authored-by: Cursor <cursoragent@cursor.com>
TreeElement was both a flex layout container and the overflow:auto
scroll element, so the virtualizer sizer (a flex child with
height: totalSize) was squashed by flex-shrink: 1 and the scroll area
visibly grew as react-virtual re-measured rows during scroll. Move
overflow/scrollbar onto a new block-level TreeScrollContainer so the
sizer's height is honored, and forward the public ref to it for
direct scrollTop access.

Co-authored-by: Cursor <cursoragent@cursor.com>
@tenphi tenphi merged commit fe05e4c into main May 4, 2026
16 checks passed
@tenphi tenphi deleted the fix-tree-event-handling branch May 4, 2026 14:21
@github-actions github-actions Bot mentioned this pull request May 4, 2026
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.

1 participant