Skip to content

chore(CaretDownIcon): Replace all usages of CaretDownIcon with RhUiCaretDownIcon#12368

Open
tlabaj wants to merge 4 commits into
patternfly:mainfrom
tlabaj:caret_down_icon
Open

chore(CaretDownIcon): Replace all usages of CaretDownIcon with RhUiCaretDownIcon#12368
tlabaj wants to merge 4 commits into
patternfly:mainfrom
tlabaj:caret_down_icon

Conversation

@tlabaj
Copy link
Copy Markdown
Contributor

@tlabaj tlabaj commented Apr 21, 2026

What: towards #12244

Summary

  • Standardize caret-down usage on RhUiCaretDownIcon from @patternfly/react-icons/dist/esm/icons/rh-ui-caret-down-icon, replacing CaretDownIcon (caret-down-icon) and RhMicronsCaretDownIcon (rh-microns-caret-down-icon) across react-core, react-table, integration demos, and doc/example imports.
  • Tests: update jest.mock paths where needed; refresh Jest snapshots for DOM changes (single RH UI SVG vs. previous nested PF + RH overlay from createIcon).
  • Alert: in AlertToggleExpandButton.test.tsx, add @testing-library/jest-dom and assert getByRole('button') for toBeVisible() (typed HTMLElement vs. firstChild).

Summary by CodeRabbit

  • Style

    • Updated dropdown and caret indicators across selects, menus, toggles, modals, wizards, demos, and examples to use a new icon variant for consistent visual styling.
  • Tests

    • Added Jest DOM matchers and improved visibility assertion for the alert toggle test.

Review Change Stack

Closes #12395

@tlabaj tlabaj requested review from a team, nicolethoen and wise-king-sullyman and removed request for a team April 21, 2026 15:03
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 21, 2026

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: 23445393-7e00-4f0f-bffb-ef638ac8af9c

📥 Commits

Reviewing files that changed from the base of the PR and between d262982 and efd7232.

⛔ Files ignored due to path filters (3)
  • packages/react-core/src/components/MenuToggle/__tests__/__snapshots__/MenuToggle.test.tsx.snap is excluded by !**/*.snap
  • packages/react-core/src/components/Pagination/__tests__/__snapshots__/Pagination.test.tsx.snap is excluded by !**/*.snap
  • packages/react-core/src/components/SearchInput/__tests__/__snapshots__/SearchInput.test.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (1)
  • packages/react-core/src/components/MenuToggle/MenuToggle.tsx
✅ Files skipped from review due to trivial changes (1)
  • packages/react-core/src/components/MenuToggle/MenuToggle.tsx

Walkthrough

Replaced usages of legacy caret icons with RH-branded variants (RhMicronsCaretDownIcon / RhUiCaretDownIcon) across multiple components, demos, and markdown examples; and added @testing-library/jest-dom to a single Alert test and simplified its visibility assertion.

Changes

Caret icon modernization

Layer / File(s) Summary
Core component icon swaps
packages/react-core/src/components/FormSelect/FormSelect.tsx, packages/react-core/src/components/MenuToggle/MenuToggle.tsx, packages/react-core/src/components/SearchInput/SearchInput.tsx, packages/react-core/src/components/Wizard/WizardToggle.tsx, packages/react-core/src/deprecated/components/Wizard/WizardToggle.tsx
Replaced imports and JSX uses of CaretDownIcon with RH-branded variants (RhMicronsCaretDownIcon or RhUiCaretDownIcon) in each component's toggle/chevron rendering; no prop, state, or behavior changes.
Examples, demos, and docs
packages/react-core/src/components/Breadcrumb/examples/Breadcrumb.md, packages/react-core/src/components/Menu/examples/Menu.md, packages/react-core/src/components/Modal/examples/Modal.md, packages/react-core/src/demos/CustomMenus/CustomMenus.md, packages/react-core/src/deprecated/components/Modal/examples/Modal.md, packages/react-integration/demo-app-ts/src/components/demos/BreadcrumbDemo/BreadcrumbDemo.tsx
Updated example/demo/documentation imports and example markup to use RhMicronsCaretDownIcon instead of CaretDownIcon.
Menu example wiring
packages/react-core/src/components/Menu/examples/Menu.md, packages/react-core/src/components/MenuToggle/MenuToggle.tsx
Menu toggle and examples updated to import and render RhMicronsCaretDownIcon in place of CaretDownIcon.

Test adjustment

Layer / File(s) Summary
Alert test matcher and assertion
packages/react-core/src/components/Alert/__tests__/AlertToggleExpandButton.test.tsx
Imported @testing-library/jest-dom and changed the "Renders without children" test to assert the rendered button is visible directly (removed the extra data-testid="container" wrapper).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

Possibly related PRs

Suggested reviewers

  • nicolethoen
  • thatblindgeye
  • bekah-stephens
  • andrew-ronaldson
🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (3 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title claims replacement with RhUiCaretDownIcon, but the actual changes show RhMicronsCaretDownIcon in most files, with only WizardToggle using RhUiCaretDownIcon. The title should reflect that replacements use RhMicronsCaretDownIcon for most components and RhUiCaretDownIcon for Wizard components, not just RhUiCaretDownIcon universally.
Linked Issues check ⚠️ Warning The PR replaces CaretDownIcon with icons across components, but uses RhMicronsCaretDownIcon in most files rather than RhUiCaretDownIcon as required by issue #12395. Ensure all CaretDownIcon replacements use RhUiCaretDownIcon consistently as specified in acceptance criteria, not RhMicronsCaretDownIcon.
Out of Scope Changes check ⚠️ Warning The PR includes a test update to AlertToggleExpandButton adding @testing-library/jest-dom import and changing assertions to use getByRole/toBeVisible, which appears unrelated to caret icon replacement. The test assertion changes should be separated into a distinct PR or justified as necessary for the icon replacement changes.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 and usage tips.

@patternfly-build
Copy link
Copy Markdown
Collaborator

patternfly-build commented Apr 21, 2026

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/react-core/src/components/Alert/__tests__/AlertToggleExpandButton.test.tsx (1)

22-22: ⚠️ Potential issue | 🟡 Minor

firstChild assertion not migrated as stated in the PR description.

The PR description says this assertion was changed to getByRole('button') with a typed HTMLElement instead of firstChild, but line 22 still uses screen.getByTestId('container').firstChild. firstChild is typed as ChildNode | null, and toBeVisible() from @testing-library/jest-dom expects an Element, which can cause a TS error and yields a less robust assertion than targeting the button by role.

✏️ Proposed fix
-  expect(screen.getByTestId('container').firstChild).toBeVisible();
+  expect(screen.getByRole('button')).toBeVisible();

The surrounding <div data-testid="container"> wrapper would then no longer be needed.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/react-core/src/components/Alert/__tests__/AlertToggleExpandButton.test.tsx`
at line 22, Replace the brittle/incorrect firstChild usage in the test: instead
of using screen.getByTestId('container').firstChild with its ChildNode typing,
query the button directly via screen.getByRole('button') and assert its
visibility with toBeVisible(); update the variable typing to HTMLElement if you
store the result, and remove the surrounding <div data-testid="container">
wrapper and any references to getByTestId('container') since the role-based
query makes it unnecessary.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In
`@packages/react-core/src/components/Alert/__tests__/AlertToggleExpandButton.test.tsx`:
- Line 22: Replace the brittle/incorrect firstChild usage in the test: instead
of using screen.getByTestId('container').firstChild with its ChildNode typing,
query the button directly via screen.getByRole('button') and assert its
visibility with toBeVisible(); update the variable typing to HTMLElement if you
store the result, and remove the surrounding <div data-testid="container">
wrapper and any references to getByTestId('container') since the role-based
query makes it unnecessary.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3da3402f-8364-4f14-9375-c1f6e77ed278

📥 Commits

Reviewing files that changed from the base of the PR and between 6558bdd and 73cfce8.

⛔ Files ignored due to path filters (16)
  • packages/react-core/src/components/Card/__tests__/__snapshots__/CardHeader.test.tsx.snap is excluded by !**/*.snap
  • packages/react-core/src/components/DataList/__tests__/__snapshots__/DataListToggle.test.tsx.snap is excluded by !**/*.snap
  • packages/react-core/src/components/ExpandableSection/__tests__/__snapshots__/ExpandableSection.test.tsx.snap is excluded by !**/*.snap
  • packages/react-core/src/components/Form/__tests__/__snapshots__/FormFieldGroup.test.tsx.snap is excluded by !**/*.snap
  • packages/react-core/src/components/FormSelect/__tests__/__snapshots__/FormSelect.test.tsx.snap is excluded by !**/*.snap
  • packages/react-core/src/components/JumpLinks/__tests__/__snapshots__/JumpLinks.test.tsx.snap is excluded by !**/*.snap
  • packages/react-core/src/components/MenuToggle/__tests__/__snapshots__/MenuToggle.test.tsx.snap is excluded by !**/*.snap
  • packages/react-core/src/components/Nav/__tests__/Generated/__snapshots__/NavExpandable.test.tsx.snap is excluded by !**/*.snap, !**/generated/**
  • packages/react-core/src/components/Nav/__tests__/__snapshots__/Nav.test.tsx.snap is excluded by !**/*.snap
  • packages/react-core/src/components/NotificationDrawer/__tests__/__snapshots__/NotificationDrawerGroup.test.tsx.snap is excluded by !**/*.snap
  • packages/react-core/src/components/SearchInput/__tests__/__snapshots__/SearchInput.test.tsx.snap is excluded by !**/*.snap
  • packages/react-core/src/components/Tabs/__tests__/__snapshots__/OverflowTab.test.tsx.snap is excluded by !**/*.snap
  • packages/react-core/src/components/Tabs/__tests__/__snapshots__/Tabs.test.tsx.snap is excluded by !**/*.snap
  • packages/react-core/src/components/TreeView/__tests__/__snapshots__/TreeViewListItem.test.tsx.snap is excluded by !**/*.snap
  • packages/react-core/src/deprecated/components/Wizard/__tests__/Generated/__snapshots__/WizardToggle.test.tsx.snap is excluded by !**/*.snap, !**/generated/**
  • packages/react-core/src/deprecated/components/Wizard/__tests__/__snapshots__/Wizard.test.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (39)
  • packages/react-core/src/components/Accordion/AccordionToggle.tsx
  • packages/react-core/src/components/Accordion/__tests__/AccordionToggle.test.tsx
  • packages/react-core/src/components/Alert/AlertToggleExpandButton.tsx
  • packages/react-core/src/components/Alert/__tests__/AlertToggleExpandButton.test.tsx
  • packages/react-core/src/components/Breadcrumb/examples/Breadcrumb.md
  • packages/react-core/src/components/Card/CardHeader.tsx
  • packages/react-core/src/components/ClipboardCopy/ClipboardCopyToggle.tsx
  • packages/react-core/src/components/DataList/DataListToggle.tsx
  • packages/react-core/src/components/DataList/examples/DataList.md
  • packages/react-core/src/components/DualListSelector/DualListSelectorTreeItem.tsx
  • packages/react-core/src/components/ExpandableSection/ExpandableSection.tsx
  • packages/react-core/src/components/ExpandableSection/ExpandableSectionToggle.tsx
  • packages/react-core/src/components/Form/FormFieldGroupToggle.tsx
  • packages/react-core/src/components/FormSelect/FormSelect.tsx
  • packages/react-core/src/components/Icon/examples/Icon.md
  • packages/react-core/src/components/Icon/examples/IconBasic.tsx
  • packages/react-core/src/components/JumpLinks/JumpLinks.tsx
  • packages/react-core/src/components/Menu/examples/Menu.md
  • packages/react-core/src/components/MenuToggle/MenuToggle.tsx
  • packages/react-core/src/components/Modal/examples/Modal.md
  • packages/react-core/src/components/Nav/NavExpandable.tsx
  • packages/react-core/src/components/NotificationDrawer/NotificationDrawerGroup.tsx
  • packages/react-core/src/components/SearchInput/SearchInput.tsx
  • packages/react-core/src/components/Tabs/OverflowTab.tsx
  • packages/react-core/src/components/Tabs/Tabs.tsx
  • packages/react-core/src/components/TreeView/TreeViewListItem.tsx
  • packages/react-core/src/components/Wizard/WizardNavItem.tsx
  • packages/react-core/src/components/Wizard/WizardToggle.tsx
  • packages/react-core/src/demos/CustomMenus/CustomMenus.md
  • packages/react-core/src/demos/DataList/examples/DataListExpandableControlInToolbar.tsx
  • packages/react-core/src/demos/DataListDemo.md
  • packages/react-core/src/deprecated/components/DualListSelector/DualListSelectorTreeItem.tsx
  • packages/react-core/src/deprecated/components/Modal/examples/Modal.md
  • packages/react-core/src/deprecated/components/Wizard/WizardNavItem.tsx
  • packages/react-core/src/deprecated/components/Wizard/WizardToggle.tsx
  • packages/react-integration/demo-app-ts/src/components/demos/BreadcrumbDemo/BreadcrumbDemo.tsx
  • packages/react-table/src/components/Table/CollapseColumn.tsx
  • packages/react-table/src/components/Table/utils/decorators/treeRow.tsx
  • packages/react-table/src/demos/Table.md

@tlabaj tlabaj changed the title chore(ExternalLinkSquareAltIcon): Replace all usages of CaretDownIcon with RhUiCaretDownIcon chore(CaretDownIcon): Replace all usages of CaretDownIcon with RhUiCaretDownIcon Apr 21, 2026
@tlabaj tlabaj requested review from a team April 21, 2026 15:57
Copy link
Copy Markdown
Contributor

@kmcfaul kmcfaul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andrew-ronaldson @lboehling

Want to confirm - do we want to use the "ui" or "micron" CaretDownIcon from RHDS? Should it be consistently always one set or will there be cases where different sets should be used?

@bekah-stephens
Copy link
Copy Markdown

@andrew-ronaldson @lboehling

Want to confirm - do we want to use the "ui" or "micron" CaretDownIcon from RHDS? Should it be consistently always one set or will there be cases where different sets should be used?

we haven't "officially" defined the use case for ui vs. micron, but I know Erin is working on documentation to do so. I believe in most cases we want to use the micron version of the caret because of the components it's used in. @andrew-ronaldson does that sound right?

@andrew-ronaldson
Copy link
Copy Markdown
Collaborator

We are using microns in all carets in expandable components in design. rh-micron-caret-down

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace CaretDownIcon with RhUiCaretDownIcon

6 participants