Skip to content

fix: apply middle-ellipsis modifier classes to prevent double-truncation - #800

Open
16navigabraham wants to merge 1 commit into
CalloraOrg:mainfrom
16navigabraham:fix/breadcrumb-middle-ellipsis-overflow
Open

fix: apply middle-ellipsis modifier classes to prevent double-truncation#800
16navigabraham wants to merge 1 commit into
CalloraOrg:mainfrom
16navigabraham:fix/breadcrumb-middle-ellipsis-overflow

Conversation

@16navigabraham

Copy link
Copy Markdown

Closes #750

Note on scope

The issue references src/pages/PlanSelector.tsx, which does not exist anywhere in this repo (confirmed via full-text search and git history). The middle-ellipsis breadcrumb feature the issue describes was already fully implemented in src/components/Breadcrumb.tsx by a prior contribution (issue #567, demonstrated via src/pages/RateLimitCard.tsx) — truncateMiddle(), the collapsed-items popover, keyboard navigation, and full title/aria-label preservation were all already in place and already covered by 27 existing tests.

What was actually missing

The stylesheet defines .breadcrumb-link--middle-ellipsis / .breadcrumb-current--middle-ellipsis modifier classes specifically to disable the CSS-level text-overflow: ellipsis once JS has already shortened a label — the comment directly above them explains this prevents a "start…en…" double-truncation artefact when the JS-truncated string still doesn't fit an extremely narrow container. But the JSX never actually applied either modifier class, so that protection was dead code. The same gap existed for the popover's expanded-item links, which had no modifier class defined for them at all.

Fix

  • Apply breadcrumb-link--middle-ellipsis / breadcrumb-current--middle-ellipsis to BreadcrumbLink when the label is actually truncated (not unconditionally).
  • Add a matching breadcrumb-popover-link--middle-ellipsis modifier (CSS + JSX) for the popover's expanded items, which had the identical gap.

Tests

5 new cases in Breadcrumb.test.tsx confirming the modifier class is present exactly when a label is truncated (first-crumb link, current-page crumb, popover links) and absent when it isn't.

npx vitest run src/components/Breadcrumb.test.tsx
 Test Files  1 passed (1)
      Tests  34 passed (34)

Repo-wide npx vitest run has 68 pre-existing failures across 13 files (confirmed unrelated — none touch Breadcrumb.tsx/Breadcrumb.test.tsx).

Closes CalloraOrg#750

Note on scope: the issue references src/pages/PlanSelector.tsx, which
does not exist anywhere in this repo (confirmed via full-text and git
history search). The middle-ellipsis breadcrumb feature the issue
describes was already fully implemented in src/components/Breadcrumb.tsx
by a prior contribution (issue CalloraOrg#567, demonstrated via
src/pages/RateLimitCard.tsx) — truncateMiddle(), the collapsed-items
popover, keyboard nav, and full title/aria-label preservation were all
already in place and already covered by 27 existing tests.

What was actually missing: the stylesheet defines
.breadcrumb-link--middle-ellipsis / .breadcrumb-current--middle-ellipsis
modifier classes specifically to disable the CSS-level
text-overflow: ellipsis once JS has already shortened a label — the
comment directly above them explains this prevents a "start…en…"
double-truncation artefact when the JS-truncated string still doesn't
fit an extremely narrow container. But the JSX never actually applied
either modifier class, so that protection was dead code. This also
applied to the popover's expanded-item links, which had no modifier
class defined for them at all.

Fixed by:
- Applying breadcrumb-link--middle-ellipsis / breadcrumb-current--middle-ellipsis
  to BreadcrumbLink when the label is actually truncated.
- Adding a matching breadcrumb-popover-link--middle-ellipsis modifier
  (CSS + JSX) for the popover's expanded items, which had the identical
  gap.

Tests: 5 new cases in Breadcrumb.test.tsx confirming the modifier class
is present exactly when a label is truncated (first-crumb link,
current-page crumb, popover links) and absent when it isn't.

npx vitest run src/components/Breadcrumb.test.tsx
 Test Files  1 passed (1)
      Tests  34 passed (34)
Copilot AI review requested due to automatic review settings July 28, 2026 12:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@drips-wave

drips-wave Bot commented Jul 28, 2026

Copy link
Copy Markdown

@16navigabraham Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

Polish PlanSelector breadcrumb overflow with middle-ellipsis [b#073]

2 participants