Skip to content

refactor(components)!: drop the .sf-card auto-shrink of nested button labels - #602

Merged
jackgranatowski merged 3 commits into
mainfrom
claude/button-size-visibility-issue-40xlwy
Jul 12, 2026
Merged

refactor(components)!: drop the .sf-card auto-shrink of nested button labels#602
jackgranatowski merged 3 commits into
mainfrom
claude/button-size-visibility-issue-40xlwy

Conversation

@jackgranatowski

@jackgranatowski jackgranatowski commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Why

.sf-card .sf-btn { --sf-btn-font-size--size: var(--sf-card-btn-font-size, var(--sf-text-s)) } silently pinned every button nested in a card to the text-s label size. So the same .sf-btn rendered smaller inside a card than outside, and a .sf-btn--xl in a footer lost its size.

This is context-dependent restyling — one component quietly overriding another — and an audit of the whole framework found it's the only rule of its kind. It's surprising (it caused a real preview bug in #601) and unpredictable, so we remove it in favour of the Bootstrap/Tailwind model: an element looks the same regardless of its container; you opt into a smaller button explicitly.

What

  • Remove the .sf-card .sf-btn rule (optional/components.css).
  • Remove the now-orphaned --sf-card-btn-font-size token, its annotation, its llm-guide entry, and the configurator's "Nested button size" control.
  • Regenerate registry / docs / demos / api-index — 755 tokens (was 756); update the token-api snapshot, audit report and coverage list.
  • Document the break in docs/migration.md and CHANGELOG.md.

Migrating

Buttons in cards now render at their own size (default .sf-btn = text-m). For a compact card action, size the button explicitly — as you would anywhere:

<div class="sf-card__footer">
  <button class="sf-btn sf-btn--primary sf-btn--s">Open</button>
</div>

Or shrink every button in a card variant in bulk:

.sf-card--compact .sf-btn { --sf-btn-font-size--size: var(--sf-text-s); }

Verification

Measured in Chromium (built dist):

button font-size
.sf-btn outside a card 19.4px (text-m)
.sf-btn in .sf-card__footer 19.4px — identical, no auto-shrink
.sf-btn--s in a card 14.7px (text-s) — explicit still works

All green: 10 CSS gates (incl. check:dead-knobs — no orphan token, audit 755 tokens), 109 node unit tests, configurator tsc / svelte-check / check:curation / 164 vitest + 25 component tests.

Notes

🤖 Generated with Claude Code


Generated by Claude Code

Summary by CodeRabbit

  • Breaking Changes

    • Buttons inside cards now retain their own size instead of automatically using compact text.
    • Use .sf-btn--s or an explicit size override for compact card actions.
    • Removed the deprecated --sf-card-btn-font-size token.
  • Documentation

    • Updated migration guidance, token references, configurator controls, demos, and API documentation to reflect the new card button behavior and reduced token count.

… labels

The `.sf-card .sf-btn { --sf-btn-font-size--size: var(--sf-card-btn-font-size,
var(--sf-text-s)) }` rule silently pinned every button nested in a card to the
text-s label size, so the same .sf-btn rendered smaller inside a card than
outside it (and a .sf-btn--xl in a footer lost its size). This context-dependent
restyling — one component quietly overriding another — was surprising and is the
only rule of its kind in the framework, so it is removed.

Buttons in cards now render at their own size (default = text-m), like anywhere
else — the Bootstrap/Tailwind model. Add .sf-btn--s explicitly for a compact
card action, or scope a size tier on a card variant to shrink them in bulk.

- Remove the .sf-card .sf-btn rule (optional/components.css).
- Remove the now-orphaned --sf-card-btn-font-size token, its annotation, its
  llm-guide entry, and the configurator "Nested button size" control.
- Regenerate registry/docs/demos/api-index (755 tokens, was 756); update the
  token-api snapshot, audit report and coverage list.
- Document the break in docs/migration.md and CHANGELOG (Breaking Changes).

Verified in Chromium: a default .sf-btn in a card footer now measures text-m
(19.4px), identical to outside a card; an explicit .sf-btn--s stays text-s.

BREAKING CHANGE: buttons nested in .sf-card no longer auto-shrink to text-s;
add .sf-btn--s for a compact card action. The --sf-card-btn-font-size token is
removed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_01GnwqYHgHNAWPbsUJWUeY1w
@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@jackgranatowski, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 43 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 51be7fd0-21e6-4572-8595-1470f3c3aa45

📥 Commits

Reviewing files that changed from the base of the PR and between 207e6f5 and 444d1ee.

📒 Files selected for processing (2)
  • docs/components.md
  • tests/card.spec.js
📝 Walkthrough

Walkthrough

The card component no longer shrinks nested button labels or exposes --sf-card-btn-font-size. Registries, configurators, generated indexes, documentation, demos, audit results, and snapshots were updated to reflect the removal.

Changes

Card button sizing

Layer / File(s) Summary
Card button behavior
optional/components.css, optional/tokens.components.css
Nested card buttons retain their own sizing, and compact actions require explicit sizing such as .sf-btn--s.
Token registry and catalogs
token-registry.json, configurator/src/..., docs/api-index.*, docs/token-index.*, docs/tokens.md, docs/registry.json
The removed token is marked accordingly, removed from controls and generated catalogs, and token totals decrease by one.
Migration and token documentation
docs/migration.md, CHANGELOG.md, docs/llm-guide.md, docs/token-annotations.json
Migration guidance and token documentation describe the breaking card-button sizing change.
Demos and validation artifacts
demos/*.html, docs/test-coverage-6-token-reference.html, reports/full-api-audit/results/tokens-report.json, tests/token-api.snapshot.json
Displayed counts, token reference data, audit output, and snapshots omit the removed token.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested labels: codex

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main breaking change: removing .sf-card's automatic shrinking of nested button labels.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/button-size-visibility-issue-40xlwy

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.

@coderabbitai coderabbitai Bot added the codex label Jul 11, 2026
@greptile-apps

greptile-apps Bot commented Jul 11, 2026

Copy link
Copy Markdown

Greptile Summary

This PR removes the only context-dependent component override in the framework: the .sf-card .sf-btn rule that silently pinned every button nested inside a card to --sf-text-s, causing sized buttons (e.g., .sf-btn--xl) to lose their explicit size inside cards. The change adopts the Bootstrap/Tailwind model — an element renders the same regardless of its container.

  • Deletes the .sf-card .sf-btn scoped rule from optional/components.css and its companion --sf-card-btn-font-size token from optional/tokens.components.css, plus all downstream generated artifacts (registry, docs, demos, audit report, snapshot).
  • Documents the break in docs/migration.md under the existing "0.7.8 → 0.8.0" section with two concrete migration recipes (explicit .sf-btn--s or a scoped card-variant override), updates CHANGELOG.md under "Unreleased", and removes the configurator "Nested button size" control.

Confidence Score: 5/5

Safe to merge — the change is a clean removal with no residual references, full artifact regeneration, and clear migration documentation.

The CSS deletion is minimal and surgical; the token is consistently removed from every generated artifact (registry, snapshot, docs, audit report, configurator, demos, LLM guide). The migration guide provides actionable replacement patterns. The token-registry correctly marks ID 725 as removed to avoid future ID collision. No stale references remain.

No files require special attention — all generated outputs are updated in lockstep with the source change.

Important Files Changed

Filename Overview
optional/components.css Removes the .sf-card .sf-btn scoped rule and updates the .sf-card block comment to reflect the new no-auto-shrink behaviour.
optional/tokens.components.css Removes the --sf-card-btn-font-size token declaration and updates the subcomponents comment block.
docs/migration.md Adds a breaking-change subsection under SLASHED 0.7.8 → 0.8.0 with two concrete migration paths.
token-registry.json Marks ID 725 (--sf-card-btn-font-size) as removed to preserve stable numeric ID assignment.
tests/token-api.snapshot.json Removes --sf-card-btn-font-size from the public-token snapshot, keeping the API surface at 755 tokens.
CHANGELOG.md Adds a Breaking Changes entry under Unreleased describing the auto-shrink removal.
docs/llm-guide.md Removes the --sf-card-btn-font-size line from the card token block, keeping the LLM guide in sync.
configurator/src/components/panels/ComponentsPanel.svelte Removes the Nested button size control from the Card section of the configurator UI.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[".sf-btn inside .sf-card"] --> B["Before this PR"]
    A --> C["After this PR"]
    B --> D[".sf-card .sf-btn rule fires\nlocks font-size to text-s\nignores explicit size modifiers"]
    C --> F["No scoped override\nbutton uses its own size tier"]
    F --> G["Default .sf-btn = text-m\n.sf-btn--xl = text-xl"]
    G --> H["Want compact? Add .sf-btn--s explicitly"]
    G --> I["Want all smaller? Set --sf-btn-font-size--size on card variant"]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A[".sf-btn inside .sf-card"] --> B["Before this PR"]
    A --> C["After this PR"]
    B --> D[".sf-card .sf-btn rule fires\nlocks font-size to text-s\nignores explicit size modifiers"]
    C --> F["No scoped override\nbutton uses its own size tier"]
    F --> G["Default .sf-btn = text-m\n.sf-btn--xl = text-xl"]
    G --> H["Want compact? Add .sf-btn--s explicitly"]
    G --> I["Want all smaller? Set --sf-btn-font-size--size on card variant"]
Loading

Reviews (1): Last reviewed commit: "refactor(components)!: drop the .sf-card..." | Re-trigger Greptile

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
docs/test-coverage-6-token-reference.html (1)

112-112: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider generating TOKENS from the same source of truth.

The token list is correctly updated here, but it's a hardcoded literal array duplicated across multiple artifacts (this file, docs/registry.json, docs/api-index.json, docs/api-index.md). Each token addition/removal (like this PR's) requires manually syncing all of them. Generating this array at build time from docs/registry.json would eliminate that drift risk going forward.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/test-coverage-6-token-reference.html` at line 112, Update the TOKENS
initialization in the generated test-coverage artifact to derive its values from
the shared docs/registry.json source during the build, rather than maintaining a
duplicated hardcoded array. Adjust the artifact-generation flow so
docs/registry.json remains the single source of truth and the related
docs/api-index outputs stay synchronized automatically.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@optional/components.css`:
- Around line 403-404: Update the card button documentation in
docs/components.md to reflect that nested .sf-btn no longer auto-shrinks. Remove
or rewrite the --sf-card-btn-font-size token-table entry and describe using the
explicit .sf-btn--s class for compact card actions.

---

Nitpick comments:
In `@docs/test-coverage-6-token-reference.html`:
- Line 112: Update the TOKENS initialization in the generated test-coverage
artifact to derive its values from the shared docs/registry.json source during
the build, rather than maintaining a duplicated hardcoded array. Adjust the
artifact-generation flow so docs/registry.json remains the single source of
truth and the related docs/api-index outputs stay synchronized automatically.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b7bfdb91-8154-4a16-81cf-64511522f76e

📥 Commits

Reviewing files that changed from the base of the PR and between e756716 and 207e6f5.

⛔ Files ignored due to path filters (1)
  • dist/css-custom-data.json is excluded by !**/dist/**
📒 Files selected for processing (21)
  • CHANGELOG.md
  • configurator/src/components/panels/ComponentsPanel.svelte
  • configurator/src/data/api-index.generated.json
  • configurator/src/data/token-registry.generated.json
  • demos/full-api-demo-with-overrides.html
  • demos/full-api-demo.html
  • docs/api-index.json
  • docs/api-index.md
  • docs/llm-guide.md
  • docs/migration.md
  • docs/registry.json
  • docs/test-coverage-6-token-reference.html
  • docs/token-annotations.json
  • docs/token-index.json
  • docs/token-index.md
  • docs/tokens.md
  • optional/components.css
  • optional/tokens.components.css
  • reports/full-api-audit/results/tokens-report.json
  • tests/token-api.snapshot.json
  • token-registry.json
💤 Files with no reviewable changes (4)
  • docs/llm-guide.md
  • configurator/src/components/panels/ComponentsPanel.svelte
  • tests/token-api.snapshot.json
  • docs/token-annotations.json

Comment thread optional/components.css
claude added 2 commits July 11, 2026 20:46
Address CodeRabbit review on PR #602: docs/components.md (hand-authored, not
gated by check:llm-guide) still described nested .sf-btn as auto-shrinking to
--sf-card-btn-font-size and listed the removed token in the card token table.
Rewrite the prose to point at explicit .sf-btn--s and drop the table row.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_01GnwqYHgHNAWPbsUJWUeY1w
tests/card.spec.js asserted the old behaviour ("a nested .sf-btn shrinks
relative to a standalone one"), which the Regression suite flagged after the
.sf-card .sf-btn rule was removed (nested == standalone: 19.11 == 19.11). Rewrite
it to the new contract: a plain nested .sf-btn matches a standalone one (no
auto-shrink), and .sf-btn--s opts into a compact card action.

Verified in Chromium against the exact markup: loose == nested == 19.41px;
compact (.sf-btn--s) == 14.68px < loose.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_01GnwqYHgHNAWPbsUJWUeY1w
@jackgranatowski
jackgranatowski merged commit d4cf4d6 into main Jul 12, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants