9

Is there a standard way to make screen readers spell out numbers?

I am currently using NVDA and Firefox and have the following telephone number

<p>01234 567890</p>

This is read as

Zero one two three four five hundred and sixty seven thousand eight hundred and ninety

This is quite confusing to the listener. I would like some way of specifying that the screen reader should spell out the number like

Zero one two three four five six seven eight nine zero

Kevin Brydon
  • 12,524
  • 8
  • 46
  • 76
  • Question about similar issue with *VoiceOver*: [Voice over doesn't read phone number properly](http://stackoverflow.com/q/21774899/1591669) – unor Feb 18 '14 at 13:32

4 Answers4

4

Maybe the speak-numeral property in you stylesheet?

The speak-numeral property is used only in Aural Stylesheets.

The aural rendering of a document combines sounds and voices to go through the content of a document. Aural presentation occurs often by converting the document to plain text and then feeding this to a screen reader.

Situations and markets for listening to information could be:

  • for blind people
  • in the car
  • help users learning to read

The speak-numeral property specifies how numerals will be spoken.

Source: http://www.w3schools.com/xslfo/prop_speak-numeral.asp

Also, I found this post helpful: http://www.nicksmith.co.uk/blog/2007/11/09/does-your-screen-reader-read-phone-numbers-properly/

I then came up with the following idea:

0<span>7000</span> 1<span>2</span>1 0<span>2</span>2

In VoiceOver this reads “zero, seven thousand, one, two, one zero, two, two”. Notice I kept the ’7000′ as one number; to me “seven thousand” is more memorable than “seven zero zero zero”.

and further

My research into aural CSS properties found that the property I’d need is already there – ‘speak-numeral: digits;’

Community
  • 1
  • 1
Kenny Thompson
  • 1,494
  • 12
  • 28
  • 2
    Please see http://meta.stackexchange.com/questions/8231/are-answers-that-just-contain-links-elsewhere-really-good-answers. I've added the relevant info from these links now so you have an example on how to provide these type of answers in the future. Thanks. – Gordon Feb 17 '14 at 15:38
  • 1
    Looks like `speak-numeral` is what I am looking for but currently can't get it to work. Once I do I'll update the post with an example and mark as answer. – Kevin Brydon Feb 18 '14 at 08:35
4

I don’t know if (or which) screen readers support these, but (in an ideal world) they should.

CSS: Aural

Speak the numeral as individual digits. Thus, "237" is spoken "Two Three Seven".

Speak numbers one digit at a time, for instance, "twelve" would be spoken as "one two", and "31" as "three one".

HTML: tel URI

RFC 3996: The tel URI for Telephone Numbers

So instead of

<p>01234 567890</p>

you would have something like

<a href="tel:01234-567890">01234 567890</a>

HTML: Vocabularies

Community
  • 1
  • 1
unor
  • 92,415
  • 26
  • 211
  • 360
0

I think the best thing is to write the number this way, it's semantically correct and (breaks the Brail users experience see @slugolicious comment) makes the screen reader announce phone number by it's digits

<a 
    href="tel:01234567890" 
    aria-label="0 1 2 3 4 5 6 7 8 9 0"
>
    01234 567890
</a>

if you are using Twig as a template engine, you could do it this way

<a 
    href="tel:01234567890" 
    aria-label="{{ "01234567890"|split('')|join(' ') }}"
>
    01234 567890
</a>

Credits: https://jhalabi.com/blog/accessibility-phone-number-formatting

nulll
  • 1,465
  • 1
  • 17
  • 28
  • 1
    Css aural didnt work for me. This answer did. Thanks – JFC Feb 28 '23 at 23:27
  • 1
    This answer is **not** "semantically correct". You should not try to force the screen read to announce numbers a certain way (other than using CSS Aural, which isn't fully supported yet) because that **breaks** the experience for Braille users. The `aria-label` with spaces will cause a Braille user to read the phone number as "zero space one space two space three space...". That is, the Braille user will be reading literal "space" characters in the number. – slugolicious Mar 01 '23 at 16:46
  • @slugolicious good point! I have fixed the answer based on your feedback, thanks! – nulll Mar 01 '23 at 17:01
  • Thanks @nulll, sorry to be harsh – slugolicious Mar 01 '23 at 22:57
-2

you can use a character split

int[] numbers;
for(int i = 0; i<string.length; i++) {
   numbers.add(string[i]);
}

note code is not tested since i dont know what language you are using java, c#, perl

  • 1
    I don't understand. The answer is likely to come in the form of manipulating the html or a css property that I am not aware of (i.e. client side). The server side language bears no relation to the answer. – Kevin Brydon Feb 18 '14 at 08:41
  • the above is javascript, clientside, the basic idea is to take the number string a split it to an array of single diget number so one thousand will become 1, 0, 0, 0 which is easier to read out. It is something i've done before in a home automation system, for play back of voice mails and reading out the phone numbers that were left. – Theodor Solbjørg Feb 18 '14 at 08:49
  • My question is specific in the context of reading web pages. NVDA (and other screen readers) will take html markup (and possibly the underlying stylesheet) and read out the pages automatically. It's unlikely that javascript will be able to help me unless I can trigger it at the point of the screen reader trying parse a number. – Kevin Brydon Feb 18 '14 at 09:19