0

I have a custom QuickAction menu in my app. I have added contentDescription "Open Menu" for the ImageView which opens the menu. So my TalkBack(form the Accessibility settings) announces the same.
The popup menu has setOutsideTouchable(true) to dismiss it when touched outside. When TalkBack is On user has to double tap to dismiss it but Android does not announce any such message. Ideally, it should announce "Double tap to dismiss ...".
How can I achieve this ?

Also, I would like to announce when the menu is dismissed. I have tried sending AccessibilityEvent inside:
QuickAction.setOnDismissListener(new myQuickAction.OnDismissListener() { @Override public void onDismiss() { // tried sending event here }

Added reference image to explain in detail. On clicking button blue popup is the QuickAction popup. Now I want to announce "Dismiss Menu" when user tap anywhere(black dot) on white region. White region is actually my LinearLayout containing header, footer etc.(that are not shown in the image). I have tried adding the contentDescription, importantForAccessibility for the layout but to no avail.

Reference Image

r.bhardwaj
  • 1,603
  • 6
  • 28
  • 54
  • 2
    You should not manually announce a window being dismissed. Let TalkBack handle that. If there is no announcement, there should not be an announcement. Additionally, there is no need to add an action for dismissal. Using the back button (or TalkBack's gesture shortcut for back) should close your popup. – alanv Mar 24 '15 at 22:01

1 Answers1

1

I would add either a little "X" box, or if you don't want to mess up your UI, make your layout container focusable, and add the content-description "Double Tap to Dismiss". (Note: The double tap is a talkback gesture, don't add this, just replicating from your question.)

EDIT: Essentially, what I'm recommending, is instead of adding an "X" button to the view, allow the layout view to act as an "X" button itself. By adding a contentDescription to the layout, you are making it focusable, even though typical users wouldn't interact with this view, nothing is keeping TalkBack users from doing so. Thus you do not change your layout visually, but still have the accessibility benefit of a separate close button, even though technically speaking this is not necessary, as users should understand how to close modals without it.

I don't believe announcing that it has been dismissed is necessary. Shifting focus back to the element that was focused before you opened the modal is the typical approach. Have this happen after your double tap, and TalkBack users will know the menu was dismissed, because they are back in the main view, on the element that opened the modal.

Sidenote: Ensure your QuickAction behaves as a modal!

MobA11y
  • 18,425
  • 3
  • 49
  • 76
  • I don't want to add invisible "X" box. I have tried making the layout focusable and adding contentDescription but to no avail. The QuickAction behavior is default (it uses a PopupWindow) which pops up when a view inside my layout is clicked. I have used https://github.com/lorensiuswlt/NewQuickAction. Can you tell me which layout/view gets click when I touch outside the QuickAction popup ? If I can know this information then I can set the contentDescription for that view/layout. – r.bhardwaj Mar 24 '15 at 09:10
  • You should be able to add a content description to "@+id/tracks" and ensure that importantForAccessibility is set to yes, and not no or auto. http://androidsbs.blogspot.com/2013/11/androidimportantforaccessibility.html – MobA11y Mar 24 '15 at 13:29
  • 1
    This is a reasonable solution, but please never include the interaction model (e.g. "Double Tap") in a content description. TalkBack adds this on its own, and any static interaction model that you provide won't make sense for braille or switch access. – alanv Mar 24 '15 at 21:59
  • @ChrisCM: "@+id/tracks" is the part of popup so adding contentDescription for that is not making any difference. I have edited my question to make it more clear. – r.bhardwaj Mar 25 '15 at 06:58
  • 1
    @alanv: You are right. I would not include "Double Tap"(as popup also dismisses on two fingers tap). But I would like the app to announce something when the user tap outside the popup. It does not detect touch on any view/layout inside the white region(reference image) until the popup is closed. – r.bhardwaj Mar 25 '15 at 07:20
  • You seem to be assuming that TalkBack users don't know how to dismiss modals. I would either reference my edit, or even just leave things alone. If your view is properly modal (as you've described in your above comment, the inability to interact with things behind the screen, and the fact that touching the screen does nothing, it is behaving as such), TalkBack users will know how to dismiss modals. What you're trying to do would be like telling a sighted user to click on the background to dismiss it somewhere within your UI. They don't need this information, it is just assumed. – MobA11y Mar 25 '15 at 15:52
  • 1
    Look at how the default settings menu behaves in TalkBack, and replicate that behavior with your custom Modal. Though, I believe, this is the way it is behaving already :). It is your own infamiliarity with TalkBack that is making you believe your app is confusing. Don't worry, TalkBack users know how to use TalkBack better than you and I! They'll figure it out. Adding additional information that they don't need, can actually be interpreted as LESS ACCESSIBLE, and frequently misleading. (See AlanV's comments about "Double Tap") – MobA11y Mar 25 '15 at 16:00
  • 1
    @ChrisCM: As I have already mentioned in my edited lines that I tried adding a contentDescription to the layout below the popup but it does not change anything. But I would buy your argument that " infamiliarity with TalkBack that is making you believe your app is confusing" :) Anyways, I have decided to leave it like that. Thanks for the explanation. – r.bhardwaj Mar 26 '15 at 13:49
  • Yeah, I think some additional stuff you might need to do (beyond the contentDescription) might be hidden in comments. Like ensuring that isImportantForAccessibility is set to true. Otherwise, contentDescription or not, it won't get focused. Good info for the future! Leaving it the way it is I think is the best call for this scenario though. – MobA11y Mar 26 '15 at 16:17
  • 1
    I have tried all the "additional stuff" like isImportantForAccessibility, focusable, clickable etc. :) – r.bhardwaj Mar 27 '15 at 10:43
  • It really should work. If you're happy with your current solution, it doesn't really matter. But, if I get time next week, I might hit back and get that little package working myself to see what's up! – MobA11y Mar 27 '15 at 13:27
  • Sure. Your help would be much appreciated. :) Till then I prefer leaving it as such. – r.bhardwaj Mar 27 '15 at 13:59