Announce QuickAction window dismissal with TalkBack - android

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.

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!

Related

Make onFocus event available on a touchable element in React Native on non-TVs

Is there any way to enable onFocus, onBlur etc. on Touchable-Elements on non-TVs devices?
The touchable elements event is not triggered, but the default feedback is visible when I use the physical keyboard.
I need simple dialogs on a Zebra mc3300. This device has a physical keyboard and when I show a dialog with a yes/no question, one button should have focus when the dialog becomes visible.
I'm not sure, maybe ref.current?.focus() works, when I press enter the key onPress is triggered, but i don't get any visible feedback which key has the focus. Only when I use the hardware button to switch to the next element and back again, the button became a different opacity.
Many thanks to you.

Make TalkBack read button content description programmatically

I have a button with 2 states, start and stop. In accessibility mode using TalkBack when the user double-taps the button I change the text of the button to stop so I must say to TalkBack in some way that this happened. I managed to achieve removing and readding focus to the button with following:
button.performAccessibilityAction(AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS, null);
// This works for the focus but doesn't make TalkBack speak. button.performAccessibilityAction(AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS, null);
// Needed for TalkBack to speak.
button.performAccessibilityAction(AccessibilityNodeInfo.ACTION_SELECT, null);
The problem with this is that TalkBack will only read the content description, but not say "double tap to activate" which gets read when you select the button manually.
Following didn't work:
button.requestFocus();
button.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED);
button.clearFocus();
button.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED);
Maybe somebody has a hint what am I missing?
In your clickListener use announceAccessibility

How to detect loss of accessibility focus with on-screen navigation buttons?

I'm looking at the Support4Demos from the Android SDK and I'm not sure if this is working as intended. Specifically, I'm referring to accessibility focus when using the Widget > Explore by Touch Helper demo. If I tap on one of the blue regions to give it accessibility focus then tap on the on-screen home button focus will switch to the home button. But if I tap on the same blue region as before nothing happens (but if I tap on the other blue region focus transfers from the home button). I'm testing this on a Kindle with on-screen navigation buttons.
Am I correct in assuming that focus should transfer back to the blue region? If so, what is the proper way to handle this? Presumably there would be a way to know that the user tapped on something outside of the app and in response to this I could clear state in the ExploreByTouchHelper but I'm not sure how I would go about that.

Keep search interface open

Is there a way to keep the search (widget or dialog) open even if the user clicks on the screen? I've seen many Google apps doing this (Keep, GMail, Youtube...) but not so many apps from external developers...
I have my search edit text visible on the ActionBar but as soon as I tap somewhere else on the screen, it is dismissed. I only want it dismissed if the user clicks on the action bar icon or presses the back key.
Is it possible? Thanks in advance!
Intercept the touch event on the container view.
Check if the SearchView is expanded.
If it is do nothing
Other idea, is cutting the SearchView being collapsed whenever the container sends touch event signals down to the view tree if it is already expanded. Or make sure it does not collapse when the SearchView looses the focus. Make sure you properly collapsed, when back key is pressed.
These are just ideas.
Hope it helps.

EditText.setError() popup placement

I'm using the v16 API and having problems with where the popup is being placed when the onscreen keyboard is displayed.
The first problem is that if the EditText is at the bottom of the screen, when I touch the field to open it for editing the popup is displayed below the control and the immediately covered as the keyboard appears. It doesn't reposition itself above the EditText until a keypress triggers my validation code to fire again on the new value.
The second problem is that when I close the keyboard and the ScrollView containing the text scrolls back down from where it positioned itself to show the EditText above the keyboard the popup remains placed on the upper half of the screen instead of where the EditText is until I touch something else on the screen (triggering the ScrollView to do a redraw???).
Unfortunately that popup has various problems like this :(
Perhaps a simple solution in your case is to forcibly invalidate the UI when the keyboard has displayed and dismissed? Can't recall if the Popup will reposition if the EditText is invalidated, but worth trying as the alternative may be to re-implement.
Checkout my android-formidable-validation lib on github, it re-implements...though has its own problems - if you go down that path, why not give me a hand with some contributions ;)

Categories

Resources