Skip to content

fix(Link): keep the gap between icon and text in a nested Button - #3053

Draft
Lisa18289 wants to merge 2 commits into
mainfrom
claude/button-text-icon-link-spacing-b2b459
Draft

fix(Link): keep the gap between icon and text in a nested Button#3053
Lisa18289 wants to merge 2 commits into
mainfrom
claude/button-text-icon-link-spacing-b2b459

Conversation

@Lisa18289

Copy link
Copy Markdown
Member

A Button with an icon and a label loses the spacing between them as soon as it sits inside a Link — the icon ends up glued to the text.

Link wrapped all Button children in a single Text, which collapsed icon and label into one flex item. The button's column-gap then had nothing to apply to, and the icon got flow--text--icon instead of flow--button--icon, so the :has(.text) .icon margin fallback didn't apply either.

Now only plain string children get the wrapper — the same condition Button itself uses via isStringContent. Side effect: an icon-only Button in a Link gets its square icon-only padding back, which the always-present .text had suppressed.

Covered by a new WithButtonAndIcon story and two extra rows in the Link with Button visual scenario (icon+text and icon-only). The darwin baselines are updated; the linux ones come from the update-screenshots label.

🤖 Generated with Claude Code

Link wrapped all Button children in a single `Text`, collapsing icon and
label into one flex item. The button's `column-gap` then had nothing to
apply to, and the icon lost its `flow--button--icon` class, so the
`:has(.text) .icon` margin didn't apply either — icon and label ended up
glued together.

Wrap only plain string children, the same condition `Button` itself uses.
This also restores the icon-only padding for an icon-only Button in a
Link, which the always-present `.text` had suppressed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@Lisa18289 Lisa18289 self-assigned this Sep 1, 2026
@Lisa18289 Lisa18289 added update-screenshots Label a PR to update the screenshots used for visual regression testing run-visual-tests Runs the full visual regression suite against the existing baselines and fails the check on mismatch labels Sep 1, 2026
@github-actions github-actions Bot removed run-visual-tests Runs the full visual regression suite against the existing baselines and fails the check on mismatch update-screenshots Label a PR to update the screenshots used for visual regression testing labels Sep 1, 2026
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Coverage Report for ./packages/components/

Status Category Percentage Covered / Total
🔵 Lines 78.69% 746 / 948
🔵 Statements 78.57% 763 / 971
🔵 Functions 80.09% 165 / 206
🔵 Branches 70.33% 377 / 536
File CoverageNo changed files found.
Generated in workflow #6502 for commit cf03fa7 by the Vitest Coverage Report Action

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

🚀 Preview Deployment

Preview environments are ready:

Type URL
docs pr-3053.docs.review.flow-components.de
storybook pr-3053.storybook.review.flow-components.de

Images:

  • docs: ghcr.io/mittwald/flow/docs:pr-3053
  • storybook: ghcr.io/mittwald/flow/storybook:pr-3053

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

❌ Visual Regression Tests Failed

At least one shard did not pass. If snapshots differ from the committed baselines, download the visual-diffs-* artifacts from this run to inspect the actual/diff images (a shard that failed before comparison, e.g. during install or browser setup, leaves none).

If the differences are intentional, update the baselines by adding the update-screenshots label to the PR.

Run details

Co-authored-by: Lisa18289 <84317589+Lisa18289@users.noreply.github.com>
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.

1 participant