Skip to content

fix(TreeView): pass id,inert to TreeViewList#12548

Open
kmcfaul wants to merge 1 commit into
patternfly:mainfrom
kmcfaul:treeview-list-id
Open

fix(TreeView): pass id,inert to TreeViewList#12548
kmcfaul wants to merge 1 commit into
patternfly:mainfrom
kmcfaul:treeview-list-id

Conversation

@kmcfaul

@kmcfaul kmcfaul commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

What: Closes #12241

  • Passes id (as new rootListId prop on TreeView) and inert (hidden, used by animations opt in) directly to TreeViewList instead of relying on spreading generic props which was passing duplicate ids unintentionally.

Summary by CodeRabbit

  • New Features

    • Tree views now support an optional root list ID, making it easier to identify the top-level list in the DOM.
    • Tree views can now be marked as inert when needed.
  • Tests

    • Added coverage to verify the root list ID is applied correctly.
    • Updated list rendering checks to confirm the ID is passed through as expected.

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 140cd710-5db4-4173-b948-2b2afbb507d3

📥 Commits

Reviewing files that changed from the base of the PR and between f8bcd7c and 473b2ca.

⛔ Files ignored due to path filters (1)
  • packages/react-core/src/components/TreeView/__tests__/__snapshots__/TreeView.test.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (4)
  • packages/react-core/src/components/TreeView/TreeView.tsx
  • packages/react-core/src/components/TreeView/TreeViewList.tsx
  • packages/react-core/src/components/TreeView/__tests__/TreeView.test.tsx
  • packages/react-core/src/components/TreeView/__tests__/TreeViewList.test.tsx

Walkthrough

Added rootListId and inert optional props to TreeViewProps, and inert to TreeViewListProps. TreeView now destructures and forwards these as id and inert to TreeViewList, addressing duplicate ID propagation. Tests were updated to mock and assert the new id behavior.

Changes

TreeView rootListId/inert props

Layer / File(s) Summary
Prop contract and wiring
packages/react-core/src/components/TreeView/TreeView.tsx, packages/react-core/src/components/TreeView/TreeViewList.tsx
TreeViewProps adds rootListId?: string and inert?: boolean; TreeViewListProps adds inert?: boolean; TreeView destructures these and forwards them as id={rootListId} and inert={inert} to TreeViewList.
Tests for id propagation
packages/react-core/src/components/TreeView/__tests__/TreeView.test.tsx, packages/react-core/src/components/TreeView/__tests__/TreeViewList.test.tsx
TreeViewList mock updated to render id; new test verifies TreeView passes rootListId through as id; TreeViewList test replaced to assert rendering with the passed id prop.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Consumer
  participant TreeView
  participant TreeViewList
  Consumer->>TreeView: render with rootListId, inert
  TreeView->>TreeViewList: id={rootListId}, inert={inert}
  TreeViewList->>TreeViewList: render ul with id, inert attributes
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main TreeView change.
Linked Issues check ✅ Passed The PR addresses the duplicate TreeView id bug by routing the root id through rootListId and verifies the behavior with tests.
Out of Scope Changes check ✅ Passed The added inert prop support and test updates are directly related to the TreeView id/inert fix.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@patternfly-build

patternfly-build commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

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.

Bug - TreeView - duplicate ID

2 participants