Skip to content

fix(textbadge)!: remove outer horizontal margin — BREAKING: badges now need a gapped parent (CUI-51) - #1254

Open
eve-ci-cd[bot] wants to merge 6 commits into
development/1.0from
feature/CUI-51-implement
Open

eve-ci-cd[bot] wants to merge 6 commits into
development/1.0from
feature/CUI-51-implement

Conversation

@eve-ci-cd

@eve-ci-cd eve-ci-cd Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

TL;DR — TextBadge no longer carries an outer horizontal margin, so a badge lines up with its container's edge and every wrapped line of a long label starts at the same x. Tabs keep their original spacing through a gap on TabItem instead of a per-child margin.

📷 Screenshots

TextBadge, Default
TextBadge, custom color and removable
Tabs, scrollable tabs (affected)

Context / Why

On an inline span, a horizontal margin only applies to the first and last line fragments. A badge placed first in a column sat 4px off the edge, and wrapped lines started at different x positions (CUI-51).

🧩 Approach

  1. TextBadge.component.tsx — drop margin: 0 ${spacing.r4} 0 ${spacing.r4} from StyledTextBadge.
  2. StyledTabs.ts / Tabsv2.component.tsx — TabItem gets gap: r4, and TabIcon trims ButtonIcon's own padding-right from r8 to r4 so it does not stack with that gap. An icon with no label gets no padding, matching ButtonIcon.
  3. stories/textbadge.stories.tsx — adjacent badges take their spacing from a parent Stack gap="r8". The narrow-container story renders the long badge directly in the 160px block, so it stays display: inline and actually splits into line fragments.
 // StyledTabs.ts › TabItem
+  gap: ${spacing.r4};

 // Tabsv2.component.tsx › TabIcon
+  padding-right: ${(props) => (props.$label ? spacing.r4 : '0')};

Measured

Root font-size is 14px here, so r4 = 3.5px and r8 = 7px.

Components/Navigation/Tabs › WithQueryParams, against the pre-PR build:

before after
icon → label 7px 7px
label → badge 3.5px 3.5px
badge box (left / right) 149.18 / 177.77 149.18 / 177.77

Adding the gap without trimming TabIcon would have pushed icon → label to 10.5px.

Components/TextBadge › Long Label In Narrow Container: the badge spans 2 line fragments, both starting at the container's content edge (84 / 84). Re-adding margin: 0 r4 turns it into 3 fragments starting at 87.5 / 84 / 84 — the CUI-51 symptom. The previous Stack version rendered the badge as a single block box and could not show this at all.

🔍 Review focus

  • 🔴 TextBadge.component.tsx › StyledTextBadge — this is the breaking change CUI-51 asks for, not an incidental one. The ticket states it:

    Impact — Breaking change. Anywhere two badges follow each other today, they will touch until the container provides the spacing, so the consumers need a pass.

    Adjacent badges, or a label next to a badge, lose 4px until the parent supplies a gap. Consumers are not updated here — the consumer pass is tracked by AIX-1236. Migration for downstream: wrap badges in a gapped parent (<Stack gap="r4">).

  • Tabsv2.component.tsx › TabIcon — the r8 → r4 trim is what keeps icon-to-label unchanged; it depends on TabItem's gap supplying the other r4.

🔗 References

  • CUI-51 — wrapped TextBadge labels are misaligned by the outer margin.
  • AIX-1236 — Guardian-side symptom; the downstream consumer pass.
  • scality/agent-task#614

Issue: CUI-51

Cerebro added 3 commits October 8, 2026 07:16
Part of the implementation plan from scality/agent-task#614.

Issue: CUI-51
…I-51)

Part of the implementation plan from scality/agent-task#614.

Issue: CUI-51
…d narrow-column story (CUI-51)

Part of the implementation plan from scality/agent-task#614.

Issue: CUI-51
@eve-ci-cd

eve-ci-cd Bot commented Oct 8, 2026

Copy link
Copy Markdown
Author

/approve

@bert-e

bert-e commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Hello eve-ci-cd[bot],

My role is to assist you with the merge of this
pull request. Please type @bert-e help to get information
on this process, or consult the user documentation.

Available options
name description privileged authored
/after_pull_request Wait for the given pull request id to be merged before continuing with the current one.
/bypass_author_approval Bypass the pull request author's approval ⭐
/bypass_build_status Bypass the build and test status ⭐
/bypass_commit_size Bypass the check on the size of the changeset TBA ⭐
/bypass_incompatible_branch Bypass the check on the source branch prefix ⭐
/bypass_jira_check Bypass the Jira issue check ⭐
/bypass_peer_approval Bypass the pull request peers' approval ⭐
/bypass_leader_approval Bypass the pull request leaders' approval ⭐
/bypass_source_branch_lineage Bypass the cross-branch contamination check ⭐
/approve Instruct Bert-E that the author has approved the pull request. ✍️
/create_pull_requests Allow the creation of integration pull requests.
/create_integration_branches Allow the creation of integration branches.
/no_octopus Prevent Wall-E from doing any octopus merge and use multiple consecutive merge instead
/unanimity Change review acceptance criteria from one reviewer at least to all reviewers
/wait Instruct Bert-E not to run until further notice.
Available commands
name description privileged
/help Print Bert-E's manual in the pull request.
/status Print Bert-E's current status in the pull request.
/clear Remove all comments from Bert-E from the history TBA
/retry Re-start a fresh build TBA
/build Re-start a fresh build TBA
/force_reset Delete integration branches & pull requests, and restart merge process from the beginning.
/reset Try to remove integration branches unless there are commits on them which do not appear on the source branch.

Status report is not available.

@bert-e

bert-e commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Waiting for approval

The following approvals are needed before I can proceed with the merge:

  • the author

  • one peer

Peer approvals must include at least 1 approval from the following list:

The following options are set: approve

Comment thread src/lib/components/tabsv2/Tabsv2.component.tsx Outdated
@bert-e

bert-e commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Waiting for approval

The following approvals are needed before I can proceed with the merge:

  • the author

  • one peer

Peer approvals must include at least 1 approval from the following list:

The following options are set: approve

@bert-e

bert-e commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Waiting for approval

The following approvals are needed before I can proceed with the merge:

  • the author

  • one peer

Peer approvals must include at least 1 approval from the following list:

The following options are set: approve

… margin (CUI-51)

Removing TextBadge's outer margin reintroduced one on a TabBadge wrapper.
Use a flex gap on TabItem instead, and trim ButtonIcon's own r8 padding to
r4 so it does not stack with that gap.

Measured in Storybook on Components/Navigation/Tabs: icon-to-label stays at
r8 and label-to-badge at r4, matching the pre-PR build pixel for pixel.

Issue: CUI-51
Comment thread src/lib/components/tabsv2/Tabsv2.component.tsx Outdated
border-radius: 4px;
font-size: 0.9rem;
font-weight: ${fontWeight.bold};
margin: 0 ${spacing.r4} 0 ${spacing.r4};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Removing this margin changes the stable TextBadge exported from index.ts. Every external consumer with adjacent badges, or a label next to a badge, loses 4px of spacing without any warning. CLAUDE.md says to ship this kind of change behind a major release or as a new version in next.ts. Either do that, or make sure the release gets a breaking-change bump and a migration note ("wrap badges in a gapped parent").

@eve-scality

eve-scality commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

🔴 Request changes

Why the tests need changes

  • The test exercises code without verifying any outcome

This review is advisory and does not block the merge.

Full review

The test exercises code without verifying any outcome

src/lib/components/textbadge/TextBadge.component.test.tsx:44-55
Test named 'renders with custom colors' asserts only that text 'env:prod' is in the document — true of any render — and never touches the customColor prop's effect.
Assert on the outcome, or explain why the call alone is the test.

…-51)

The gap compensation was unconditional, so an icon-only tab gained r4 of
trailing space that ButtonIcon never adds. Mirror ButtonIcon's own condition.

Verified in Storybook: with a label the icon keeps padding-right r4 and sits
r8 from the label; with an empty label the padding resolves to 0.

Issue: CUI-51
Comment thread stories/textbadge.stories.tsx Outdated
@bert-e

bert-e commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Waiting for approval

The following approvals are needed before I can proceed with the merge:

  • the author

  • one peer

Peer approvals must include at least 1 approval from the following list:

The following options are set: approve

… the bug (CUI-51)

The story put the long badge inside a vertical Stack, and StackBox is
display: flex, so the badge was blockified into a single box. Wrapped lines
lined up with or without the old margin, which is the regression the story
exists to cover.

Rendering it directly in the 160px block keeps it display: inline. Measured
in Storybook: the badge now spans 2 line fragments, both starting at the
container's content edge; re-adding margin: 0 r4 splits them to 3 fragments
starting at 87.5 / 84 / 84, reproducing CUI-51.

Issue: CUI-51
@bert-e

bert-e commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Waiting for approval

The following approvals are needed before I can proceed with the merge:

  • the author

  • one peer

Peer approvals must include at least 1 approval from the following list:

The following options are set: approve

@ZiyangLinScality ZiyangLinScality changed the title fix(textbadge): remove outer horizontal margin so wrapped badges align to the container edge fix(textbadge)!: remove outer horizontal margin — BREAKING: badges now need a gapped parent (CUI-51) Oct 28, 2026

This branch has not been deployed

No deployments
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.

5 participants