fix (breadcrumb): Dropdown item, ellipsis & separator breaks <ol> list structure#693
fix (breadcrumb): Dropdown item, ellipsis & separator breaks <ol> list structure#693paanSinghCoder wants to merge 1 commit intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThe breadcrumb-item component now wraps its dropdown Menu element within a Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/raystack/components/breadcrumb/breadcrumb-item.tsx (1)
57-75: Add a regression test for the dropdown branch.This path was only manually tested, and this DOM-shape bug is easy to reintroduce. A test that renders
Breadcrumb.ItemwithdropdownItemsand asserts the direct child under the breadcrumb<ol>is an<li>would lock the fix in.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/raystack/components/breadcrumb/breadcrumb-item.tsx` around lines 57 - 75, Add a regression test for the dropdown branch of the Breadcrumb.Item component: render Breadcrumb with a Breadcrumb.Item that has dropdownItems (the same shape used in breadcrumb-item.tsx Menu/Dropdown branch) and assert that the direct child under the rendered breadcrumb <ol> is an <li> (i.e., the presence of an <li> wrapper instead of the dropdown content becoming the direct child). Place the test alongside existing breadcrumb tests (using the same testing setup, e.g., react-testing-library + jest), render the component, query the <ol> element, and assert its firstElementChild.tagName === 'LI' to lock the DOM-shape fix for Breadcrumb.Item/Menu.Trigger/Menu.Content.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/raystack/components/breadcrumb/breadcrumb-item.tsx`:
- Around line 57-75: Add a regression test for the dropdown branch of the
Breadcrumb.Item component: render Breadcrumb with a Breadcrumb.Item that has
dropdownItems (the same shape used in breadcrumb-item.tsx Menu/Dropdown branch)
and assert that the direct child under the rendered breadcrumb <ol> is an <li>
(i.e., the presence of an <li> wrapper instead of the dropdown content becoming
the direct child). Place the test alongside existing breadcrumb tests (using the
same testing setup, e.g., react-testing-library + jest), render the component,
query the <ol> element, and assert its firstElementChild.tagName === 'LI' to
lock the DOM-shape fix for Breadcrumb.Item/Menu.Trigger/Menu.Content.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 6f1266a7-2c5f-49de-adce-bed3de7ca728
📒 Files selected for processing (1)
packages/raystack/components/breadcrumb/breadcrumb-item.tsx
Description
fix(breadcrumb): keep valid list structure when item has dropdown
Issue: With dropdownItems, BreadcrumbItem rendered
<Menu>as a direct child of<ol>, so the only valid children of<ol>were violated. Similar issue were found with ellipsis and separator.Change: Wrap the dropdown in
<li className={...}>so every breadcrumb item is a list item and the DOM stays valid for assistive tech.Type of Change
How Has This Been Tested?
Manual
Checklist:
Screenshots (if appropriate):
[Add screenshots here]
Related Issues
[Link any related issues here using #issue-number]
Summary by CodeRabbit