Skip to content

fix (1-breadcrumb): docs style fixes#667

Merged
paanSinghCoder merged 6 commits intomainfrom
feat/breadcrumb-auto-ellipsis
Mar 23, 2026
Merged

fix (1-breadcrumb): docs style fixes#667
paanSinghCoder merged 6 commits intomainfrom
feat/breadcrumb-auto-ellipsis

Conversation

@paanSinghCoder
Copy link
Contributor

@paanSinghCoder paanSinghCoder commented Mar 5, 2026

Breadcrumb 1st PR

Issue-600

Description

New props (root) - Reverted

- maxItems – Maximum number of breadcrumb items to show. When there are more items, the trail collapses: a fixed number at the start, ellipsis, then the rest at the end. At least 2 items are always visible (1 before and 1 after the ellipsis). Values < 2 are treated as 2.
- itemsBeforeCollapse – Number of items to show before the ellipsis when collapsed. If not set, it is derived from maxItems (e.g. maxItems={5} → 2 before, 3 after). The count after the ellipsis is always derived.

Docs updates

  • New examples: manual ellipsis
  • Props tables and copy updated (e.g. Item className, note on current prop, size example with tabs).
  • Updated docs design

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactor (no functional changes, no bug fixes just code improvements)
  • Chore (changes to the build process or auxiliary tools and libraries such as documentation generation)
  • Style (changes that do not affect the meaning of the code (white-space, formatting, etc))
  • Test (adding missing tests or correcting existing tests)
  • Improvement (Improvements to existing code)
  • Other (please specify)

How Has This Been Tested?

[Describe the tests that you ran to verify your changes]

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (.mdx files)
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works

Screenshots (if appropriate):

[Add screenshots here]

Related Issues

[Link any related issues here using #issue-number]

Summary by CodeRabbit

  • New Features

    • Breadcrumb demos: size examples split into tabs; added trailing-icon and disabled-item demos; dropdown entries can render real links.
    • Demo gallery: added a shopping-bag icon.
  • Documentation

    • Expanded guidance for current/disabled items, leading/trailing icons, dropdown item shape, and a disabled demo.
  • Accessibility

    • Current/disabled items expose aria-current/aria-disabled; separators treated as decorative.
  • Style

    • Updated styles for active, disabled, and dropdown items.
  • Tests

    • Added coverage for icons, disabled behavior, link-rendering dropdowns, and separator semantics.

@vercel
Copy link

vercel bot commented Mar 5, 2026

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

Project Deployment Actions Updated (UTC)
apsara Ready Ready Preview, Comment Mar 23, 2026 6:24am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 5, 2026

Caution

Review failed

Pull request was closed or merged during review

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Reworks Breadcrumb API, tests, docs, demos, and styles: adds trailingIcon and disabled, changes dropdownItems to pass Menu.Item props (including render for links), renders current/disabled items as non-anchors with aria/data attributes, updates separator ref/aria, and exposes a shopping-bag icon in demo scope.

Changes

Cohort / File(s) Summary
Examples & Demo scope
apps/www/src/app/examples/page.tsx, apps/www/src/components/demo/demo.tsx
Added Breadcrumb to examples import; added ShoppingBagFilledIcon import and exposed it in demo scope.
Docs & demos
apps/www/src/content/docs/components/breadcrumb/demo.ts, apps/www/src/content/docs/components/breadcrumb/index.mdx
Converted size demo into tabs; added dropdownLinksDemo and disabledDemo; updated icons demo to use real icon components; documented current, disabled, leadingIcon/trailingIcon, and dropdownItems shape (Menu.Item pass-through).
Playground usage
apps/www/src/components/playground/breadcrumb-examples.tsx
Updated dropdownItems entries to use children instead of label to match new item shape.
Props & typings
apps/www/src/content/docs/components/breadcrumb/props.ts, packages/raystack/components/breadcrumb/breadcrumb-root.tsx
Added trailingIcon?, disabled?, className? to item typings; broadened dropdownItems typing to accept Menu.Item props; added JSDoc above BreadcrumbProps.
Component behavior
packages/raystack/components/breadcrumb/breadcrumb-item.tsx, packages/raystack/components/breadcrumb/breadcrumb-misc.tsx
Changed dropdown item type to ComponentProps<typeof Menu.Item> & { key?: string }; only render dropdown when dropdownItems && !disabled; added trailingIcon handling; render current/disabled items as non-interactive <span> with aria-current/aria-disabled and data-current/data-disabled; BreadcrumbSeparator forwards ref and sets role="presentation" and aria-hidden="true".
Styling
packages/raystack/components/breadcrumb/breadcrumb.module.css
Added .breadcrumb-link-disabled; adjusted .breadcrumb-link-active behavior and added layout/typography and hover/border-radius rules for .breadcrumb-dropdown-item.
Tests
packages/raystack/components/breadcrumb/__tests__/breadcrumb.test.tsx
Expanded tests: trailing/triple icon cases, combined icons rendering order/classes, current and disabled render as spans with correct aria/data/classes, dropdown disabled behavior, dropdown render returns <a> preserving attributes, and separator accessibility attributes.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant BreadcrumbItem
  participant Menu
  participant DOM

  User->>BreadcrumbItem: click item
  alt item has dropdown && not disabled
    BreadcrumbItem->>Menu: open menu (map dropdownItems → Menu.Item)
    Menu->>DOM: render Menu.Items (items may render as <a> via render/href)
    User->>Menu: select Menu.Item → trigger action/navigation
  else item is disabled or current
    BreadcrumbItem->>DOM: render <span> (aria-current/aria-disabled, data attrs)
    User->>BreadcrumbItem: click → no navigation, no menu
  end
  BreadcrumbItem->>DOM: render Separator (role="presentation", aria-hidden="true")
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • rsbh
  • rohanchkrabrty

Poem

🐰 I hopped through crumbs and left a little sign,
Icons tucked in rows, both trailing and in line,
Disabled ones nap while current ones stay,
Menus spring to life, links true on display,
Hooray — crumbs tidy and sweet as thyme! 🥕✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title claims 'docs style fixes' but the changeset includes substantial component logic changes: icon support (trailingIcon), disabled state implementation, dropdown item shape refactoring, CSS updates, and test additions—far beyond documentation styling. Revise the title to accurately reflect the main changes, e.g., 'feat (breadcrumb): add disabled state, trailing icons, and enhanced dropdown support' or split into multiple PRs.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/breadcrumb-auto-ellipsis

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.

Copy link
Contributor

@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.

Actionable comments posted: 1

🧹 Nitpick comments (3)
packages/raystack/components/breadcrumb/breadcrumb-root.tsx (3)

148-166: keyed helper redundantly checks isValidElement.

The keyed function is only ever called with elements from beforeItems and afterItems, which are already validated as ReactElement instances from parseBreadcrumbChildren. The isValidElement(el) check is unnecessary.

♻️ Optional simplification
-        const keyed = (el: ReactElement, k: string) =>
-          isValidElement(el) && el.key != null
-            ? el
-            : cloneElement(el, { key: k });
+        const keyed = (el: ReactElement, k: string) =>
+          el.key != null ? el : cloneElement(el, { key: k });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/raystack/components/breadcrumb/breadcrumb-root.tsx` around lines 148
- 166, The keyed helper unnecessarily calls isValidElement; since
beforeItems/afterItems are already ReactElement instances from
parseBreadcrumbChildren, remove the isValidElement check in the keyed function
(breadcrumb-root.tsx) and simply return the element if el.key != null, otherwise
return cloneElement(el, { key: k }); Update the keyed helper used where
beforeItems/afterItems are iterated so it only checks el.key and clones when
missing, keeping cloneElement usage and keys (e.g., calls in the
beforeItems.forEach and afterItems.forEach loops) intact.

69-88: Consider handling unrecognized children gracefully.

The parseBreadcrumbChildren function silently drops children that don't match known breadcrumb parts (Item, Separator, Ellipsis). This could lead to confusion if users pass custom elements or text nodes. Consider either logging a warning in development or documenting this behavior.

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

In `@packages/raystack/components/breadcrumb/breadcrumb-root.tsx` around lines 69
- 88, parseBreadcrumbChildren currently drops children that aren't recognized
breadcrumb parts (BreadcrumbItem, BreadcrumbSeparator, BreadcrumbEllipsis) with
no feedback; update parseBreadcrumbChildren to warn in development when an
element is a valid React element but not matched by isBreadcrumbPart (and
optionally when a non-empty text node or unknown node is passed) by calling
console.warn or process.env.NODE_ENV check inside the flat.forEach loop;
reference the existing symbols parseBreadcrumbChildren,
flattenFragments(Children.toArray(children)), isValidElement, isBreadcrumbPart,
BreadcrumbItem, BreadcrumbSeparator, and BreadcrumbEllipsis and emit a clear
dev-only warning that includes the offending child/type so users know why their
node was dropped.

171-173: Unused _propsChildren extraction appears defensive but unnecessary.

The destructuring on line 171-173 extracts children from props to avoid passing it twice to the nav. However, children was already destructured at line 116, so it shouldn't be in props. This suggests the typing could be tightened, but it's harmless as written.

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

In `@packages/raystack/components/breadcrumb/breadcrumb-root.tsx` around lines 171
- 173, The extraction of children into _propsChildren from props (const {
children: _propsChildren, ...restProps } = props) is redundant because children
is already destructured earlier; remove that destructuring and ensure you use
the existing children variable and a restProps that does not re-extract children
(or tighten the prop typing to exclude children from props) so children is not
handled twice in BreadcrumbRoot; update references to use restProps (or a
propsWithoutChildren alias) accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/www/src/app/examples/page.tsx`:
- Around line 61-66: The Breadcrumb.Item for the "Footwear" label has the wrong
href; update the href on the Breadcrumb.Item (the JSX element with label
"Footwear") to the correct path (e.g. change
'/products/electronics/laptops/gaming/accessories' to
'/products/electronics/laptops/gaming/accessories/footwear') so the link matches
the label.

---

Nitpick comments:
In `@packages/raystack/components/breadcrumb/breadcrumb-root.tsx`:
- Around line 148-166: The keyed helper unnecessarily calls isValidElement;
since beforeItems/afterItems are already ReactElement instances from
parseBreadcrumbChildren, remove the isValidElement check in the keyed function
(breadcrumb-root.tsx) and simply return the element if el.key != null, otherwise
return cloneElement(el, { key: k }); Update the keyed helper used where
beforeItems/afterItems are iterated so it only checks el.key and clones when
missing, keeping cloneElement usage and keys (e.g., calls in the
beforeItems.forEach and afterItems.forEach loops) intact.
- Around line 69-88: parseBreadcrumbChildren currently drops children that
aren't recognized breadcrumb parts (BreadcrumbItem, BreadcrumbSeparator,
BreadcrumbEllipsis) with no feedback; update parseBreadcrumbChildren to warn in
development when an element is a valid React element but not matched by
isBreadcrumbPart (and optionally when a non-empty text node or unknown node is
passed) by calling console.warn or process.env.NODE_ENV check inside the
flat.forEach loop; reference the existing symbols parseBreadcrumbChildren,
flattenFragments(Children.toArray(children)), isValidElement, isBreadcrumbPart,
BreadcrumbItem, BreadcrumbSeparator, and BreadcrumbEllipsis and emit a clear
dev-only warning that includes the offending child/type so users know why their
node was dropped.
- Around line 171-173: The extraction of children into _propsChildren from props
(const { children: _propsChildren, ...restProps } = props) is redundant because
children is already destructured earlier; remove that destructuring and ensure
you use the existing children variable and a restProps that does not re-extract
children (or tighten the prop typing to exclude children from props) so children
is not handled twice in BreadcrumbRoot; update references to use restProps (or a
propsWithoutChildren alias) accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 65b1ecac-7a92-4967-8461-a9e16b6675b4

📥 Commits

Reviewing files that changed from the base of the PR and between 1301b55 and 1aa6c11.

📒 Files selected for processing (7)
  • apps/www/src/app/examples/page.tsx
  • apps/www/src/components/demo/demo.tsx
  • apps/www/src/content/docs/components/breadcrumb/demo.ts
  • apps/www/src/content/docs/components/breadcrumb/index.mdx
  • apps/www/src/content/docs/components/breadcrumb/props.ts
  • packages/raystack/components/breadcrumb/__tests__/breadcrumb.test.tsx
  • packages/raystack/components/breadcrumb/breadcrumb-root.tsx

@paanSinghCoder paanSinghCoder self-assigned this Mar 5, 2026
@paanSinghCoder paanSinghCoder changed the title feat (breadcrumb): add automatic ellipsis support and hide items feat (breadcrumb-1): add automatic ellipsis support and hide items Mar 5, 2026
@paanSinghCoder paanSinghCoder changed the title feat (breadcrumb-1): add automatic ellipsis support and hide items feat (1-breadcrumb): add automatic ellipsis support and hide items Mar 5, 2026
@paanSinghCoder paanSinghCoder changed the title feat (1-breadcrumb): add automatic ellipsis support and hide items fix (1-breadcrumb): docs style fixes Mar 9, 2026
@paanSinghCoder paanSinghCoder marked this pull request as draft March 11, 2026 06:09
@paanSinghCoder paanSinghCoder marked this pull request as ready for review March 11, 2026 06:20
* feat: add disabled prop support for item

* feat: add trailing item support from item

* feat(breadcrumb): update separator accessibility attributes to use role="presentation" and aria-hidden="true"

* fix: replace <a> with <span> for current item

* style(breadcrumb): enhance active link styling with hover effect and default cursor

* chore: Remove breadcrumb examples

* refactor: merge jsx

* feat (3-breadcrumb): add href support and expose data-disabled and data-current attributes (#669)

* feat (breadcrumb-dropdown): add href support

* feat: add data attributes

* refactor: merge react 19

* refactor: pass all menuItem props
Copy link
Contributor

@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.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/raystack/components/breadcrumb/breadcrumb-item.tsx`:
- Around line 92-109: The current branch returns a <span> for disabled/current
items but drops shared DOM props because ...(props) isn’t forwarded; update the
BreadcrumbItem component to forward remaining common DOM attributes (data-*,
aria-*, id, title, role, etc.) to the rendered <span
className={cx(styles['breadcrumb-link'], ...)} ref={ref} while filtering out
anchor-only props like href, target, rel; ensure the existing conditional
additions ('aria-disabled', 'data-disabled', 'aria-current', 'data-current') are
merged with the forwarded props so tests and accessibility attributes are
preserved when disabled or current.
- Around line 59-89: The dropdown branch in Breadcrumb.Item returns a Menu
directly which breaks list semantics and places the component-level className
and ref on Menu.Trigger; wrap the entire Menu in the same <li> container used by
the other branch so the item container receives className, ref and any list
semantics. Specifically, move/attach the className (styles['breadcrumb-item'] +
className) and ref to the <li> element that wraps the Menu, keep Menu.Trigger
receiving only button-specific props (exclude the item container className), and
preserve passing dropdownItems into Menu.Content/Item as currently implemented
in breadcrumb-item.tsx (identify Menu, Menu.Trigger, Menu.Content, Menu.Item and
the dropdownItems mapping).
- Around line 115-123: The cloneElement call in breadcrumb-item.tsx currently
sets className: styles['breadcrumb-link'] but then spreads
...renderedElement.props which can overwrite that className; update the
cloneElement props to merge classes using cx so the base breadcrumb-link is
preserved and any custom className from renderedElement.props or incoming props
is combined (e.g. className: cx(styles['breadcrumb-link'], props.className,
renderedElement.props?.className)); update the reference in the cloneElement
call (in the component that uses renderedElement/ref) and add a unit/test that
renders the component with as={<a className="custom" />} asserting both
styles['breadcrumb-link'] and "custom" are present to prevent regressions.

In `@packages/raystack/components/breadcrumb/breadcrumb-misc.tsx`:
- Around line 33-39: The separator currently spreads {...props} after setting
role='presentation' and aria-hidden='true' which allows callers to override
those semantics; update the Breadcrumb separator in breadcrumb-misc.tsx (the
element using ref, className, cx(styles['breadcrumb-separator'], className), and
{...props}) so the user props are applied before the fixed accessibility
attributes or remove role/aria from the public props by destructuring them out
(e.g., const { role, 'aria-hidden': ariaHidden, ...rest } = props) and then
spread rest, finally setting role='presentation' and aria-hidden='true' on the
element to ensure the separator semantics are non-overridable.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4fb8ed04-2ea0-41b3-93db-03c29a3a4455

📥 Commits

Reviewing files that changed from the base of the PR and between b3aa49b and 813f1f4.

📒 Files selected for processing (8)
  • apps/www/src/components/playground/breadcrumb-examples.tsx
  • apps/www/src/content/docs/components/breadcrumb/demo.ts
  • apps/www/src/content/docs/components/breadcrumb/index.mdx
  • apps/www/src/content/docs/components/breadcrumb/props.ts
  • packages/raystack/components/breadcrumb/__tests__/breadcrumb.test.tsx
  • packages/raystack/components/breadcrumb/breadcrumb-item.tsx
  • packages/raystack/components/breadcrumb/breadcrumb-misc.tsx
  • packages/raystack/components/breadcrumb/breadcrumb.module.css
🚧 Files skipped from review as they are similar to previous changes (3)
  • apps/www/src/content/docs/components/breadcrumb/index.mdx
  • apps/www/src/content/docs/components/breadcrumb/props.ts
  • apps/www/src/content/docs/components/breadcrumb/demo.ts

Comment on lines +33 to +39
<span
ref={ref}
className={cx(styles['breadcrumb-separator'], className)}
role='presentation'
aria-hidden='true'
{...props}
>
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Keep the separator semantics non-overridable.

...props is spread after role='presentation' and aria-hidden='true', so a caller can accidentally re-expose the separator to assistive tech. Move the spread before the fixed attrs, or omit those two props from the public surface.

Suggested fix
     <span
       ref={ref}
+      {...props}
       className={cx(styles['breadcrumb-separator'], className)}
       role='presentation'
       aria-hidden='true'
-      {...props}
     >
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<span
ref={ref}
className={cx(styles['breadcrumb-separator'], className)}
role='presentation'
aria-hidden='true'
{...props}
>
<span
ref={ref}
{...props}
className={cx(styles['breadcrumb-separator'], className)}
role='presentation'
aria-hidden='true'
>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/raystack/components/breadcrumb/breadcrumb-misc.tsx` around lines 33
- 39, The separator currently spreads {...props} after setting
role='presentation' and aria-hidden='true' which allows callers to override
those semantics; update the Breadcrumb separator in breadcrumb-misc.tsx (the
element using ref, className, cx(styles['breadcrumb-separator'], className), and
{...props}) so the user props are applied before the fixed accessibility
attributes or remove role/aria from the public props by destructuring them out
(e.g., const { role, 'aria-hidden': ariaHidden, ...rest } = props) and then
spread rest, finally setting role='presentation' and aria-hidden='true' on the
element to ensure the separator semantics are non-overridable.

@paanSinghCoder paanSinghCoder merged commit 9d4cf92 into main Mar 23, 2026
4 of 5 checks passed
@paanSinghCoder paanSinghCoder deleted the feat/breadcrumb-auto-ellipsis branch March 23, 2026 06:25
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.

[Breadcrumb] Structural improvements and feature enhancements

2 participants