refactor(ui): tokenize bg-card/NN opacity one-offs into surface-translucency tiers#8052
Conversation
…lucency tiers 52 sites across 21 files used ad-hoc bg-card/NN opacity fractions with no semantic meaning -- the dominant cluster being one repeated three-class idiom (bg-card/95 backdrop-blur supports-[backdrop-filter]:bg-card/80) copy-pasted across every sticky table header and the compare-drawer shells. Author two tiers in packages/ui-kit/src/styles.css: .mg-glass (the sticky- header/drawer-shell blur idiom, one class instead of three) and .mg-glass-soft (a flat 60%, no blur, for inset panels). Both compose var(--card), so they theme automatically. Sweep: the full triple-idiom and blur-paired /95 sites -> mg-glass (12 sites); the clean /60 sites plus three /50-/40 outliers that snap cleanly without a visible regression -> mg-glass-soft (10 sites). Two /80 sites (a homepage chip carousel, an account-history segmented toggle) don't cleanly snap to either tier without visibly changing them -- left as bare fractions with an inline comment explaining why, same documented-exception treatment #7841 used for its own two non-literal reassignments. Left the ~24-site "rounded-2xl bg-card/95 ... mg-card-glow[-accent]" KPI- tile family (accounts.$ss58.tsx, validators.$hotkey.tsx) untouched: mixing blur into cards that never had it would be a real visual regression, and that pattern is already scheduled for its own Panel `glow`-prop consolidation (#7848) -- reworking it here would just be double churn. Warn-tier guardrail in both eslint configs still flags these, same residual-worklist convention as every other token rule. Along the way, fixed a real Lightning CSS minifier bug: two textually- identical `blur(8px)` declarations (backdrop-filter + its -webkit- twin) in one rule get collapsed down to just the prefixed one, silently dropping the standard property. Dropped the -webkit- fallback entirely -- Safari has shipped unprefixed backdrop-filter since version 18 (2024) -- which sidesteps the bug and is simpler besides. Verified via getComputedStyle in both themes: .mg-glass resolves to blur(8px) + 80% opacity, .mg-glass-soft to a flat 60%, both correctly composing --card in light and dark. Closes #7842
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
metagraphed-ui | eb61e51 | Commit Preview URL Branch Preview URL |
Jul 24 2026, 09:12 PM |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8052 +/- ##
=======================================
Coverage 97.67% 97.67%
=======================================
Files 220 220
Lines 27230 27230
Branches 10800 10800
=======================================
Hits 26598 26598
Misses 140 140
Partials 492 492 🚀 New features to boost your workflow:
|
|
Warning ⏸️ LoopOver review result - manual review recommendedReview updated: 2026-07-24 21:26:01 UTC
Review summary Nits — 6 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. Visual previewClick any thumbnail to open the full-size screenshot. Before = production · After = this PR's preview deploy. Scroll preview
A short scroll-through clip (desktop) — click either thumbnail to open the full animation. Evidence for scroll-linked behavior a single screenshot can't show. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|






Summary
52 sites across 21 files used ad-hoc
bg-card/NNopacity fractions with no semantic meaning — 5 different values, the dominant cluster being one repeated three-class idiom (bg-card/95 backdrop-blur supports-[backdrop-filter]:bg-card/80) copy-pasted across every sticky table header and the compare-drawer shells.Tokens
Added to
packages/ui-kit/src/styles.css:.mg-glass— the sticky-header/drawer-shell blur idiom collapsed into one class (95% opaque fallback, 80% +blur(8px)wherebackdrop-filteris supported)..mg-glass-soft— a flat 60%, no blur, for inset panels.Both compose
var(--card), so they theme automatically — verified viagetComputedStylein both light and dark.Sweep
mg-glass(12 sites): the full triple-idiom sticky headers (call-module-extrinsics-table.tsx,validator-nominators-table.tsx,blocks.index.tsx,extrinsics.index.tsx) and the standalone blur-paired/95sites (both compare-drawer shells + theads,shortcuts-popover.tsx,back-to-top.tsx).mg-glass-soft(10 sites): the 7 clean/60sites, plus 3 outliers (delegate-cta.tsxandnav-omnibox.tsxat/50,endpoint-operational-list.tsxat/40) that snap cleanly without a visible regression —/50//40are both closer to 60% than 95%, and none of them had blur to begin with.hero-subnet-chips.tsx's homepage chip carousel andaccount-history-chart.tsx's segmented-toggle track, both at/80— neither cleanly snaps to either tier without a visible regression (mg-glass would add unwanted blur; mg-glass-soft's 60% visibly lightens them). Same documented-exception treatment Design tokens 2/5: semantic z-index layering scale #7841 used for its own two non-literal reassignments.rounded-2xl bg-card/95 ... mg-card-glow[-accent]KPI-tile family inaccounts.$ss58.tsxandvalidators.$hotkey.tsx. Mixing blur into cards that never had it would be a real visual regression, and this exact pattern is already scheduled for its own Panelglow-prop consolidation in FE hardening 3/6: Panel API — rest-prop forwarding, missing tones, glow variant; convert the 31 documented skips #7848 — converting it here would just be double churn. The warn-tier guardrail still flags these, same residual-worklist convention every other token rule already uses.A real build bug found along the way
Writing
.mg-glass'sbackdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);together in one rule silently dropped the standard property in the compiled CSS — both in ui-kit's own tsup/Lightning CSS build and again in apps/ui's Tailwind pipeline (which re-processes the imported CSS). Lightning CSS's minifier treats the two textually-identicalblur(8px)values as duplicates and collapses them down to just the prefixed one. Fixed by dropping the-webkit-fallback entirely — Safari has shipped unprefixedbackdrop-filtersince version 18 (2024), so nothing needs it anymore, and with only one declaration present there's nothing left for the minifier to (mis)merge.Verification
tsc --noEmitclean in both packageseslint .(full package) — 0 errors in both; exactly 26 warnings inapps/uifrom the documented/deferred sites, exactly matching the audit aboveprettier --check .cleanvitest run— 191 files / 1465 tests inapps/ui, 16 files / 88 tests inui-kit, all passingpackages/ui-kitrebuilt (dist/index.{js,cjs,css})getComputedStyleon a sticky thead confirmsbackdrop-filter: blur(8px)+ 80% opacity background in dark mode, and the 95%/60% fallback/soft tiers resolve correctly composing--cardin both themesgrep -rn 'bg-card/[0-9]' apps/ui/src packages/ui-kit/src --include='*.tsx'→ only the 2 documented exceptions + the ~24 deferred-to-FE hardening 3/6: Panel API — rest-prop forwarding, missing tones, glow variant; convert the 31 documented skips #7848 sites remain, 0 unaccounted-forCloses #7842