2

I have set up the customized Hint for my UIButton. What I expect is that when single-tapped, the button will read the Hint; when double-tapped the Hint will not sound, but the normal button action will happen.

But in fact, the Hint is read again on double-tap, while at the same time the normal button action happens. The re-reading would be annoying enough, but the normal action is to play a different sound. They wind up being combined. Yecch!

One would think the UIAccessibilityTraitPlaysSound would be the thing to use, but it has no effect. I could just use AllowsDirectInteraction, but would then lose the Hint. In any case, the re-reading of the Hint on double-tap is just wrong. IMHO.

Andrew Duncan
  • 3,553
  • 4
  • 28
  • 55

1 Answers1

8

If I recall correctly, the plays sound trait refers to the activation sound (that sounds like a brief "blip"), and is used for an element that wants to play its own activation sound.

If you are playing anything more/longer than an activation sound, I think that you should be using the starts media session trait instead.

UIAccessibilityTraitStartsMediaSession 

The accessibility element starts a media session when it is activated.

You can use this trait to silence the audio output of an assistive technology, such as VoiceOver, during a media session that should not be interrupted. For example, you might use this trait to silence VoiceOver speech while the user is recording audio.

David Rönnqvist
  • 56,267
  • 18
  • 167
  • 205
  • 1
    That's it. The docs are pretty scanty on this. But I should know that means to just try everything. Thanks! – Andrew Duncan Dec 15 '15 at 22:46
  • Thank you so much! But what if I want to call UIAccessibility.post(notification: .announcement ...) on button tap? (I need to declare if the answer was correct or no without repeating it again) – f3dm76 Apr 03 '20 at 10:48