fix(core): improve accessibility for price displays#2829
Merged
Conversation
🦋 Changeset detectedLatest commit: d84493b The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Author
|
@chanceaclark updated per the recommended suggestions in offline discussion. |
chanceaclark
approved these changes
Jan 21, 2026
Contributor
chanceaclark
left a comment
There was a problem hiding this comment.
🍹 @jorgemoya do we also need to apply this to other places on the storefront, e.g. the product page?
Contributor
Author
Good callout, updated! |
chanceaclark
approved these changes
Jan 21, 2026
jamesqquick
pushed a commit
that referenced
this pull request
Feb 11, 2026
* fix(core): remove decorative price element from accessibility tree * fix: update to include accessibility best practices * fix: update changeset * fix: add price label component
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.
What/Why?
Improve accessibility for price displays by adding screen reader announcements for original prices, sale prices, and price ranges. Visual price elements are hidden from assistive technologies using
aria-hidden="true"to prevent duplicate announcements, while visually hidden text provides context about pricing information.Testing
Migration steps
Step 1: Update Cart Price Display
Update
core/vibes/soul/sections/cart/client.tsxto add accessibility labels for sale prices:{lineItem.salePrice && lineItem.salePrice !== lineItem.price ? ( <span className="font-medium @xl:ml-auto"> - <span className="line-through">{lineItem.price}</span> {lineItem.salePrice} + <span className="sr-only">{t('originalPrice', { price: lineItem.price })}</span> + <span aria-hidden="true" className="line-through"> + {lineItem.price} + </span>{' '} + <span className="sr-only">{t('currentPrice', { price: lineItem.salePrice })}</span> + <span aria-hidden="true">{lineItem.salePrice}</span> </span> ) : ( <span className="font-medium @xl:ml-auto">{lineItem.price}</span> )}Step 2: Update PriceLabel Component
Update
core/vibes/soul/primitives/price-label/index.tsxto add accessibility improvements for sale prices and price ranges:import { clsx } from 'clsx'; + import { useTranslations } from 'next-intl'; export function PriceLabel({ className, colorScheme = 'light', price }: Props) { + const t = useTranslations('Components.Price'); if (typeof price === 'string') { return ( ... ); } switch (price.type) { case 'range': return ( <span ...> - {price.minValue} - – - {price.maxValue} + <span className="sr-only"> + {t('range', { minValue: price.minValue, maxValue: price.maxValue })} + </span> + <span aria-hidden="true"> + {price.minValue} - {price.maxValue} + </span> </span> ); case 'sale': return ( <span className={clsx('block font-semibold', className)}> + <span className="sr-only">{t('originalPrice', { price: price.previousValue })}</span> <span + aria-hidden="true" className={clsx( 'font-normal line-through opacity-50', ... )} > {price.previousValue} </span>{' '} + <span className="sr-only">{t('currentPrice', { price: price.currentValue })}</span> <span + aria-hidden="true" className={clsx( ... )} > {price.currentValue} </span> </span> ); } }Step 3: Add Translation Keys
Update
core/messages/en.jsonto include new translation keys for price accessibility:"Cart": { "title": "Cart", "heading": "Your cart", "proceedToCheckout": "Proceed to checkout", "increment": "Increase quantity", "decrement": "Decrease quantity", "removeItem": "Remove item", "cartCombined": "We noticed you had items saved in a previous cart, so we've added them to your current cart for you.", "cartRestored": "You started a cart on another device, and we've restored it here so you can pick up where you left off.", "cartUpdateInProgress": "You have a cart update in progress. Are you sure you want to leave this page? Your changes may be lost.", + "originalPrice": "Original price was {price}.", + "currentPrice": "Current price is {price}.",