Skip to content

fix(web): stop the brand gradient bleeding through button variants - #202

Merged
SishirP17 merged 1 commit into
mainfrom
fix/button-gradient-leak
Aug 18, 2026
Merged

fix(web): stop the brand gradient bleeding through button variants#202
SishirP17 merged 1 commit into
mainfrom
fix/button-gradient-leak

Conversation

@SishirP17

Copy link
Copy Markdown
Collaborator

The Refresh button on Today's Visits had no visible label. It was not missing — it was teal text on a teal background at 1.00:1.

button paints --gradient-brand with the background shorthand, which sets background-image. Every variant tried to override it with the background-color longhand, which cannot clear an image, so the gradient kept rendering on top of the fill each variant asked for.

variant before after
.btn-ghost (29 sites) #107480 on the leaked gradient — 1.00:1 5.48:1
.btn-secondary (10 sites) #0F172A on the leaked gradient — 2.36:1 17.85:1
.btn-primary showed the gradient, never its own fill 5.48:1
.btn-danger showed the gradient, never red 4.83:1

<Link className="btn-ghost"> was unaffected, since the button element selector does not match an anchor — which is why the breakage looked arbitrary from the outside.

Introduced in 56421d8, which changed the base rule from background-color to the background shorthand without converting the variants.

What changed

  • Every variant uses the background shorthand, which resets the image layer.
  • Variants that are not brand-filled reset the inherited brand glow.
  • .btn-primary / .btn-danger labels take --color-on-brand instead of a hardcoded white.
  • The six inline backgroundColor: 'transparent' buttons leak identically and get the same treatment.

Review note

This changes the rendered background of ~106 buttons. That is the correction, not a regression — .btn-primary has never actually rendered flat teal and .btn-secondary has never rendered white — but it is a visible delta worth a look.

First of five. Merge order: this → fix/color-mix-tintsfeat/agency-theme-resolverfix/contrast-offenderschore/css-contract-guards.

The base `button` rule paints `--gradient-brand` with the `background`
shorthand, which sets background-image. Every variant tried to override it
with the `background-color` longhand, which cannot clear an image, so the
gradient kept rendering on top of the fill each variant asked for.

.btn-ghost was the worst case: transparent background, `--color-primary`
label, so it rendered the brand color on the brand gradient at 1.00:1 and
the label was invisible. The Refresh button on Today's Visits is one of 29
such buttons. .btn-secondary sat at 2.36:1, and .btn-primary/.btn-danger
showed the gradient rather than their own fill.

<Link className="btn-ghost"> was unaffected, since the `button` element
selector does not match an anchor, which is why the breakage looked
arbitrary from the outside.

Convert every variant to the `background` shorthand, reset the inherited
brand glow on the variants that are not brand-filled, and take the labels
from --color-on-brand instead of a hardcoded white. Same fix for the six
inline `backgroundColor: 'transparent'` buttons, which leak identically.
@SishirP17
SishirP17 requested a review from durga710 as a code owner August 18, 2026 22:41
@vercel

vercel Bot commented Aug 18, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
rayhealth-evv-platform-app Ready Ready Preview Aug 18, 2026 10:43pm

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