Skip to content

fix(core): tint ClickableCard background on hover instead of overlay#3712

Open
kentonquatman wants to merge 1 commit into
mainfrom
navi/fix/clickable-card-hover-tint
Open

fix(core): tint ClickableCard background on hover instead of overlay#3712
kentonquatman wants to merge 1 commit into
mainfrom
navi/fix/clickable-card-hover-tint

Conversation

@kentonquatman

Copy link
Copy Markdown
Contributor

What

Fixes a faint 1px "ring" that appeared around ClickableCard on hover for any non-default variant (blue, muted, transparent, and the color tints). On hover the interior darkened but the outer 1px edge stayed at the untinted background color.

Why it happened

Hover/active feedback was a pseudo-element (::after) positioned at inset: 0. inset: 0 aligns to the card's padding box, which sits inside the card's 1px border (transparent on tinted variants). The variant background, however, paints the full border box — under that transparent border. So on hover:

  • the overlay darkened the padding-box interior, but
  • the 1px border strip kept showing the untinted variant background → a faint ring.

The fix

Drop the pseudo-element overlay and tint the card's real background per variant on :hover/:active. Tinting the actual background paints the full border box — edge included — so there's no ring.

The tint mixes each variant's background token with --color-tint-hover (light-dark(black, white)), which darkens in light mode and lightens in dark mode. This mirrors how other interactive components (CheckboxInput, Switch, RadioList, Slider) already tint on hover, and follows the same conditional-style approach Link uses for hover feedback.

  • :hover → 5% tint (guarded by @media (hover: hover) so touch devices don't get a stuck state)
  • :active → 10% tint (works everywhere)

Each variant's resting default value equals its base token, so the non-hovered appearance is unchanged.

Testing

  • pnpm -F @astryxdesign/core build (StyleX + CSS) — generated CSS confirms per-variant color-mix(... --color-tint-hover ...) rules under @media (hover: hover) for :hover and unguarded for :active
  • pnpm -F @astryxdesign/core typecheck + typecheck:docs
  • eslint clean
  • ClickableCard tests pass (9/9)
  • docsite generate + exports/token-doc sync checks clean

Non-default ClickableCard variants (blue, muted, transparent, the color
tints) rendered a faint 1px untinted ring on hover: the hover feedback was
a pseudo-element at inset: 0 that covers the padding box but not the card's
1px transparent border, so the untinted variant background showed through
the border edge.

Replace the pseudo-element overlay with a per-variant background tint on
hover/active. Tinting the card's real background paints the full border box,
edge included, so the ring is gone. The tint mixes each variant's background
with --color-tint-hover (black in light mode, white in dark mode), darkening
in light mode and lightening in dark mode, mirroring how other interactive
components tint on hover.
@vercel

vercel Bot commented Jul 9, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
astryx Ready Ready Preview, Comment Jul 9, 2026 4:30am

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jul 9, 2026
@kentonquatman kentonquatman marked this pull request as draft July 9, 2026 04:29
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

No new or modified components detected.

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.6KB 0B

Accessibility Audit

Status: No accessibility violations detected.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

github-actions Bot added a commit that referenced this pull request Jul 9, 2026
@kentonquatman kentonquatman marked this pull request as ready for review July 9, 2026 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant