Skip to content

Latest commit

 

History

History
52 lines (38 loc) · 3.66 KB

amount.md

File metadata and controls

52 lines (38 loc) · 3.66 KB

Amount explainer

Author: Tantek Çelik

User problems to be solved

On the web, users from around the world often see numerical amounts on web pages either in unfamiliar units, or with unfamiliar punctuation denoting large or decimal amounts which can either be hard to interpret, or worse, easily misinterpreted. If publishers had a mechanism to explicitly denote these numerical amounts and their units if any, then browsers could offer a privacy-respecting user-interface to display these amounts to the user according to their local units and punctuation preferences.

Methodology for approaching & evaluating solutions

Per the priority of constituencies, we should first look for solutions that users can trust, e.g. if a solution enables an affordance to convert units, it should be 100% reliable like a calculator, as users will expect any unit conversions to be simple arithmetic. Second, we should look for solutions that are minimal work, simpler, and more dependable and robust for developers. In particular, we should look for and prefer declarative approaches over imperative approaches.

Out of scope:

  • currencies (for this Explainer), because their conversions are subjective and changing (not 100% reliable). We may still consider the backward compatible extensibility of any solutions, in order to enable a future Explainer to add currency support. We may also consider how solutions could treat a currency amount as a numerical amount with an unknown unit, for the purposes of converting at least the numerical portion to user preferred or locale-specific punctuation for large or decimal numbers.

Prior features and existing proposals

In HTML we have the <time> element which is useful for publishing date time information, and in particular durations amounts with units of seconds, minutes, hours, or days.

HTML also has the <data> element which can be used to represent numerical amounts independent of punctuation, e.g.:

<data value=1000 lang=en>1,000</data> <data value=1.5 lang=fr>1,5</data>

Both elements are used in the wild on web pages. There are techniques for using the time element to provide accessible “ago“ durations, however there are no known examples in the wild of using data elements for numerical amounts with punctuation.

Both elements are also widely natively supported by browsers (MDN data support, MDN time support), however without any default user-discernible effects, including in screen readers, despite the “First rule of ARIA use” encouraging publishers to use native HTML semantic elements.

The microformats community did a lot of research into measure formats for amounts with physical units in the mid-2000s, culminating in an hmeasure draft proposal, which was eventually evolved in the 2010s into an h-measure proposal in modern microformats2 syntax (which itself is widely used in various blogging services, software, and plugins).

...