Repository navigation
fix: thread format/asset/locale into StatCard's sparkline - #743
Open
smartcalsystems-sketch wants to merge 1 commit into
Open
smartcalsystems-sketch wants to merge 1 commit into
smartcalsystems-sketch wants to merge 1 commit into
Conversation
…geFi#709) StatCard rendered <Sparkline data={sparkline} label={label} /> without formatValue, so describeTrend fell back to String(v). A 'Lifetime earnings' card was announced as 'trending up from 1234.5 to 8420', with no currency symbol or locale grouping, while the visible value right next to it read '$8,420.00'. Pass formatValue={(v) => formatValue(v, format, asset, locale).display} -- reusing the same formatter StatCard already applies to its own headline value -- so the sparkline's accessible description agrees with what's on screen. format='raw' cards are unaffected: formatValue's raw case is already String(v), identical to the previous default.
|
@smartcalsystems-sketch is attempting to deploy a commit to the chonilius' projects Team on Vercel. A member of the Team first needs to authorize it. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
StatCardrenders<Sparkline data={sparkline} label={label} />withoutformatValue, sodescribeTrendusesString(v). A "Lifetime earnings" card is announced as "trending up from 1234.5 to 8420", with no currency or locale grouping, while the visible value is "$8,420.00".Fix
Passes
formatValue={(v) => formatValue(v, format, asset, locale).display}toSparkline— reusing the exact same formatter (and the exactformat/asset/localeprops)StatCardalready applies to its own headline value, so the sparkline's spoken description can never disagree with what's on screen.format="raw"cards are unaffected, sinceformatValue's"raw"case is alreadyString(v)— identical to the previous default.Testing
format="currency"card asserting the sparkline's accessible name now reads "trending up from 1,234.5 USDC to 8,420 USDC" instead of raw numbers.StatCard.test.tsx: 24/24 passing (23 pre-existing + 1 new), including the existingraw-format sparkline-naming test unchanged.tsc --noEmitandeslintclean on both changed files (one pre-existing, unrelatedisRTLLocaleunused-import warning confirmed present onmainbefore this change too).Closes #709