VoiceOver accessibility label for Touch ID

2019-07-04 07:26发布

I am trying to ensure that the iOS app that I am working on is accessible and am trying to implement VoiceOver to ensure this.

One strange thing that I cannot find any help for is when the Touch ID view is displayed (in my case for signing into the app). VoiceOver pronounces ID as a word and not I.D.

I have tried implementing the accessibility attributes to both NSString and the LAContext object but neither seem to change what is read out by VoiceOver. Code snippets below:

LAContext *context = [[LAContext alloc] init];
[context setIsAccessibilityElement:YES];
[context setAccessibilityLabel:@"TEST 2"];

NSError *error = nil;

NSString *label = @"Please authenticate your ID using the Touch ID";
[label setIsAccessibilityElement:YES];
[label setAccessibilityTraits:UIAccessibilityTraitStaticText];
[label setAccessibilityLabel:@"TEST"];

showingTouchID = TRUE;

if ([context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error]) {
    [context evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
            localizedReason:label
                      reply:^(BOOL success, NSError *error) {
......

The output from VoiceOver with or without context having the accessibility attributes is always the label text.

All help greatly appreciated :)

2条回答
迷人小祖宗
2楼-- · 2019-07-04 07:30

You should definitely not change the accessibility label just to make VoiceOver pronounce things correctly (i.e. do not try "hack" the label pronounciation). The reason is that VoiceOver does not have speech output only; it has also braille output where blind users expect to read things exactly letter-by-letter as they are written (i.e. see exactly all the spaces, capital/small letters, etc.) If you did e.g. write "I D" instead of "ID", then while VoiceOver would pronounce it perhaps correctly (in the specific version of iOS), blind users, after also reading "I D" on a braille display might think that that is how it is actually written and appear let's say non-professionally when they would then use this wrong spelling in written exchanges with other people.

The correct way to deal with this, albeit without giving you an immediate solution, is:

  1. File a bug with Apple about pronounciation of the specific word with the specific voice in the specific language (e.g. "Expected pronounciation: [aj'di:]" vs. "Actual pronounciation: [id]")
  2. File a bug with Apple to request the ability to customize pronunciation only (i.e. where you would leave the accessibility label intact and correct, but specify to the voice how it should pronounce certain part of the text), and where this customization could be done for each language individually by the translator translating the strings (because wrong pronunciation is language-specific) - also see the next point.
  3. If you can reword, try different word than the problematic one (which seems not applicable in case of "Touch ID" which is a set term). But this is a hack too, as that solves only the English original and does not care about translations where the rewording might on the contrary potentially complicate the pronunciation.

Sorry for the bad news.

Finally, here, both on iOS 8.4.1 and iOS 9.0.2, VoiceOver with default US English iOS voice, at least on this webpage, pronounces "ID" in "Touch ID" as [ajdi:], not [id].

查看更多
beautiful°
3楼-- · 2019-07-04 07:54

You can try this for a quick work around: Just give space between I and D

  NSString *label = @"Please authenticate your ID using the Touch ID";
  label.accessibilityLabel=@"Please authenticate your I D using the Touch I D";

Also please note that you can only set accessibility to UIElements and you cannot set it to general variables. It doesn't make sense to set accessibility label for LAContext and to NSString.

YOu need to set the accessibility label to UILabel or the element which you give the NSString to.

查看更多
登录 后发表回答