I am working on an voice accessibility feature using talkback but when the voice over reads of the text from the text view, it reads the abbreviation/initialism as a word instead of individual characters. For example FBI should be F B I and not read out as a word.
问题:
回答1:
Do not try to force a screen reader to read words or abbreviations a certain way. That can mess up the user experience for braille users. Screen readers have settings to control the verbosity and what to do with words that are in all caps. This allows the user to control how they want to hear it.
Additionally, when a word is pronounced in an unfamiliar way, the screen reader user can navigate letter by letter to hear the abbreviation.
Update November 29, 2018: Based on comments, here is some additional information.
If you have an abbreviation in the middle of a sentence, such as
The FBI always gets its man
then you can have hidden text for screen readers to force the letters to be pronounced separately, but I will again say that this is highly discouraged.
<p>The FBI always gets its man</p>
can become
<p>The <span aria-hidden="true">FBI</span> <span class="sr-only">F B I </span> always gets its man</p>
So the visible "FBI" is hidden from screen readers and it's followed by a visually hidden text of "F B I" for screen readers to announce as separate letters.
(The "sr-only" class can be seen at What is sr-only in Bootstrap 3?)
There are two (at least) disadvantages to forcing this behavior:
As mentioned, Braille users will get extra text. Granted, in this case, it's not that much but still adds to overhead in reading Braille.
Basic "FBI" in Braille:
There are two single dots in the beginning. The first single dot usually means the next character is uppercased. When you have two single dots in a row, it's like a "caps lock" so it tells you all the following letters are in caps.Embedded spaces in "F B I"
In this case, the "caps" character (single dot) has to appear before each letter because they're separate "words" and there are gaps between each letter.So "FBI" takes up 5 cells and "F B I" takes up 8 cells.
The second disadvantage is that on iOS devices and Voiceover, since the paragraph (<p>) is split up by embedded <span> elements, as you swipe right with Voiceover, it will stop on every break so you'll hear "The", then "F B I", then "always gets its man". Not a great user experience. Not sure if Talkback does the same.