Skip to content

Contain the link overlay in a linked StatCard - #118

Merged
andrewhuhh merged 2 commits into
mainfrom
andrew/stat-card-link-containment
Nov 17, 2026
Merged

andrewhuhh merged 2 commits into
mainfrom
andrew/stat-card-link-containment

Conversation

@andrewhuhh

@andrewhuhh andrewhuhh commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

A linked StatCard didn't contain its link overlay. StatCard sets data-slot="stat-card" over Card's "card", so row-link's [data-slot="card"][data-stretched-link] { position: relative } never matched it. The CardLink overlay stretched to the nearest positioned ancestor, often the page, and a click anywhere went to the last linked tile's target. This affects framed and plain cards, with or without a backdrop, on v0.1.12 and v0.1.13.

Fix

row-link.module.css now matches [data-slot="stat-card"][data-stretched-link] in its two structural rules:

  • The containment rule: position: relative and cursor: pointer.
  • The zero-specificity rule that lifts nested controls above the overlay, so a link or button in a StatCard's note stays clickable.

I chose matching the slot over making StatCard keep data-slot="card" with a separate marker. Keeping Card's slot would also pull StatCard into every hover selector keyed to "card" (the Halftone wash, icon draw motion, and the linked-card hover tint). That's the R7 hover change, which needs its own design call. It would also break any consumer that queries [data-slot="stat-card"].

Audit of [data-slot="card"] selectors

Where What StatCard
row-link.module.css, [data-stretched-link] position and cursor Containment Now matches
row-link.module.css, :where(...) control lift Structural Now matches
row-link.module.css, [data-stretched-link]:hover tint Hover Left out (R7)
row-link.module.css, chevron on hover Hover Left out. StatCard has no chevron
halftone.module.css, wash on hover Hover Left out (R7)
base.css, data-icon-motion="draw" on hover Hover Left out (R7)
lib/slash-shortcut.ts, closest('[data-slot="card"]') Shortcut scope Not needed. StatCard takes no action or children, so it can't hold a HeaderSearch

Showcase and test

The new example "Linked, framed and plain" puts four linked StatCards in a Grid: framed and plain, each with and without a Halftone backdrop. The first card's note is its own link.

visual/stat-card-link.spec.ts clicks below the grid and on the section heading and checks the URL doesn't change. It then clicks each card's value and checks that card's destination, and clicks the note link and checks it goes to its own target, not the card's. Without the CSS fix, the outside clicks navigate and the spec fails.

Visual gate

All 410 tests pass and no existing baseline changes. The only baselines are the four new stat-card-linked images, which is why this PR has visual-change.

Desktop, Light Desktop, Dark
390px, Light 390px, Dark

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@infisical-review-police

Copy link
Copy Markdown

💬 Discussion in Slack: #pr-review-cipher-118-contain-the-link-overlay-in-a-linked-statcard

Posted by Review Police — reviews, comments, new commits, and CI failures will stream into this channel.

@greptile-apps

greptile-apps Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[Low impact] The PR appears safe to merge.

Summary

The PR keeps linked StatCard overlays inside their cards and lets nested controls stay clickable.

  • Linked StatCards keep their stretched links inside the card.

Reviews (2) · Last reviewed commit: "Test whole-card clicks and a note link i..." · Reviewed by Greptile

Comment thread visual/stat-card-link.spec.ts Resolved
Comment thread site/src/examples/stat-card/linked.tsx Resolved
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@andrewhuhh
andrewhuhh merged commit f4de878 into main Nov 17, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant