Mercado Libre Juan Ignacio Unzurrunzaga Sep 23, 2022

Accessibility in prices, our learning from the Android perspective

Article Summary

Juan Ignacio Unzurrunzaga from Mercado Libre's team reveals how they fixed a critical accessibility gap that affected millions of users: price components that screen readers couldn't interpret correctly.

Mercado Libre's accessibility team tackled their price component, which had inconsistent currency readings, missing context for discount combos, and decimal separator confusion. They rebuilt it from scratch using Android's AccessibilityNodeInfo framework, creating MoneyAmount as part of their Andes UI design system.

Key Takeaways

Critical Insight

By leveraging Android's accessibility tree and custom delegates, they created a price component that reads consistently across all contexts while simplifying navigation for screen reader users.

The team's approach to handling multiple currencies and regional separators reveals a pattern that works beyond just price components.

About This Article

Problem

Mercado Libre's price component had four accessibility issues. The currency symbol read as "dollars" instead of "pesos". Combo variants showed previous price, current price, and discount as three separate elements instead of one unit. Strikethrough prices didn't have visual feedback that screen readers could access. Decimal and thousands separators confused users in different locales.

Solution

Juan Ignacio Unzurrunzaga's team built helper classes for CurrencyDescription and NumberFormatting to handle locale-specific separators. They created MoneyAmount, MoneyAmountDiscount, and MoneyAmountCombo components with custom AccessibilityDelegate classes. These classes generate a single contentDescription string using static methods.

Impact

The MoneyAmountCombo component cut screen reader navigation from three elements down to one semantic view. Now it reads as a single description like "Now: 1350 pesos, ten percent off. Before: 1500 pesos" in Spanish, Portuguese, and English.