-
Notifications
You must be signed in to change notification settings - Fork 125
fix(core/tree)- Fixed tree-items in custom tree component. #2259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: cf72143 The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
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 |
|
nuke-ellington
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Resolve conflicts
- Fix change requests
|
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request fixes an issue where custom-rendered tree items were not selectable. The fix involves a new getTreeNodeId method to correctly identify the tree node from a click event, even when the click target is a nested element within a custom tree item. The changes are logical and include a new test case to validate the fix. I have one suggestion to refactor the new getTreeNodeId method for improved readability and type safety.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Fixes ix-tree selection for custom-rendered tree items by resolving the clicked tree node id from nested click targets (matching Issue #2098).
Changes:
- Add DOM-walk helper to resolve
data-tree-node-idfrom an event target’s ancestor chain. - Use the helper for both toggle and item click handling to correctly select nodes when clicking nested custom content.
- Add a component regression test and a patch changeset entry.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/core/src/components/tree/tree.tsx | Introduces getTreeNodeId() and uses it to correctly map clicks/toggles to the owning tree item id. |
| packages/core/src/components/tree/test/tree.ct.ts | Adds a regression test intended to validate click selection for custom-rendered tree items. |
| .changeset/fair-apricots-walk.md | Patch release note for enabling selection via mouse click on custom ix-tree-items. |
| const customItem = tree.locator('ix-tree-item').nth(1); | ||
| await customItem.click(); | ||
| await expect(customItem).toHaveClass(/selected/); |
Copilot
AI
Feb 4, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This new regression test clicks the ix-tree-item host (customItem.click()), but the reported issue was that clicks on child elements inside a custom-rendered item (e.g. the nested span/div) were not registered because the event target didn’t carry data-tree-node-id. To actually cover the regression, trigger the click on the nested .custom-content (or its span) and assert selection on the parent tree item; optionally assert the custom content is present so the test guarantees the custom renderer is in use.



💡 What is the current behavior?
While using custom tree, clicking on tree-items doesn't trigger selection of these tree items.
GitHub Issue Number: #2098
🆕 What is the new behavior?
Click events are now registered and the tree items are now selectable.
🏁 Checklist
A pull request can only be merged if all of these conditions are met (where applicable):
pnpm test)pnpm lint)pnpm build, changes pushed)👨💻 Help & support