3

Im using Appcelerator for Android app,

After I set the accessibilityHint property, the Talkback completes saying this string, pauses and always says "Double tap to activate, double tap and hold for long press". How do i disable this? Tried with accessibilityLabel or accessibilityValue but no luck.

In .xml file

 <Label id='lblAppName' />

In .tss file

"#lblAppName":{
  accessibilityHint: 'Double tap here to activate me',
  text: L('app_name'),
  top:Alloy.Globals.sizes10,        
  left:Alloy.Globals.sizes58,
  right:Alloy.Globals.sizes57   
}
ataulm
  • 15,195
  • 7
  • 50
  • 92
Adnan Hussein
  • 261
  • 1
  • 4
  • 14

4 Answers4

4

TalkBack announces this because it is detecting your control as something that can be interacted with. EX: a button. Given your markup, in particular your "accessibilityHint" which I assume is an Appcelerator property, it would appear that your control is indeed a button of some kind. Why would you want to disable this helpful announcement?

My answer would be to remove your hint, and let the Android OS deal with this button the way it wants to. Your hint is no more helpful than TalkBack's "hint", and it is best to let the Assistive Technology share role and instructional information when possible.

The only way to get TalkBack to NOT announce this is to make your control non-interactive. If TalkBack detects that a control can be interacted with (clicked) it will announce these instructions, there's nothing you can, nor should do about that.

IgorGanapolsky
  • 26,189
  • 23
  • 116
  • 147
MobA11y
  • 18,425
  • 3
  • 49
  • 76
  • `let the Android OS deal with this button the way it wants to` no! I want to customize the action for the use-case: an image is in a list and it's already selected - there's no point in clicking it again (someone without an impairment would see that). So you see, the action should be nothing. – Someone Somewhere Sep 15 '20 at 01:41
  • 1
    The solution in this case would be to disable the thing that is actionable. – MobA11y Sep 15 '20 at 16:51
0

In Java:

ViewCompat.setAccessibilityDelegate(view, new AccessibilityDelegateCompat() {
    @SuppressLint("NewApi")
    public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfoCompat info) {
        super.onInitializeAccessibilityNodeInfo(host, info);
        info.setClickable(true);
        info.setLongClickable(false);
        host.setLongClickable(false);
        info.setContentDescription("Talkback will speak it");
    }
});

In Kotlin:

ViewCompat.setAccessibilityDelegate(<YOUR_TEXTVIEW>, object : AccessibilityDelegateCompat() {
    override fun onInitializeAccessibilityNodeInfo(host: View, info: AccessibilityNodeInfoCompat) {
        super.onInitializeAccessibilityNodeInfo(host, info)
        info.removeAction(AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_CLICK)
        info.isClickable = true
        info.isLongClickable = false
        info.contentDescription = "Talkback will speak it"
        host.isLongClickable = false
    }
})
SerjantArbuz
  • 982
  • 1
  • 12
  • 16
-1

https://medium.com/android-microsoft/android-accessibility-resolving-common-talkback-issues-3c45076bcdf6

This might help

ViewCompat.setAccessibilityDelegate(set_actions_button, object : AccessibilityDelegateCompat() {
    override fun onInitializeAccessibilityNodeInfo(v: View, info: AccessibilityNodeInfoCompat) {
        super.onInitializeAccessibilityNodeInfo(v, info)
        info.addAction(AccessibilityActionCompat(
            AccessibilityNodeInfoCompat.ACTION_CLICK, "Edit note"))
        info.addAction(AccessibilityActionCompat(
            AccessibilityNodeInfoCompat.ACTION_LONG_CLICK, "Copy note"))
    }
})
Harvey
  • 1,353
  • 1
  • 14
  • 27
-1

Some of my devices were adding "double tap and hold to long press" or etc. I just wanted to read my whole paragraph and add "Double tap to activate" only. So I wrote like this;

ViewCompat.setAccessibilityDelegate(<YOUR_TEXTVIEW>, object : AccessibilityDelegateCompat() {
            override fun onInitializeAccessibilityNodeInfo(host: View, info: AccessibilityNodeInfoCompat) {
                super.onInitializeAccessibilityNodeInfo(host, info)
                info.removeAction(AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_CLICK)
                info.isClickable = false
                info.isLongClickable = false
                info.text = "${<YOUR_TEXTVIEW>.text}\n" + "Double tap to activate."
                host.isLongClickable = false
            }
        })
Wicaledon
  • 710
  • 1
  • 11
  • 26