Android TalkBack and chunk stack

For an application I'm working on, I need to implement accessibility. Everything works fine except for one screen where I have fragments added to my work. Basically, the snippet above is the keypad for entering a password. This fragment is added using fragmentation.

The point is that the focus of the feedback is set on the elements of the lower fragment.

Do you know if there is a way to set feedback focus on a set fragment? I just want to "disable" the fragment from the bottom to get focus

Thank,

+3


source to share


5 answers


UPDATE

I figured out the solution. you can disable the availability of the first chunk prior to executing the chunk transaction.

rootView = inflater.inflate(R.layout.first_fragment, null, false);

rootView.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS);

      



and now you are committing a fragment transaction. The second fragment will not flow focus to the first fragment.

Remember to turn on the availability of the first snippet if you go back to the first snippet.

if(rootView != null) {
    rootView.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES);
}

      

+4


source


Are you using the fragmentTransaction.add method?

If so, you can use the fragmentTransaction.replace function!



The add function also caused problems with clicking the below snippets.

So please use replace.

0


source


Perhaps you can call requestAccessibilityFocus () when the second fragment resumes

@Override
public void onResume() {
    super.onResume();
    yourView.requestAccessibilityFocus();
}

      

0


source


Take a look at the method representation. sendAccessibilityEvent

(AccessibilityEvent.TYPE_VIEW_FOCUSED). sendAccessibilityEvent

changes focus from Talkback. I don't know much about Talkback, pls read the link on SO @ When using TalkBack, what's the preferred way to alert the user when the content of the TextView has changed? ...

Good luck ...

-1


source


Your problem is not "sending" the focus to the right place. Forcing focus around different locations is generally a bad idea and not available. Your problem is that you have items on the screen that are not visible but focus on TalkBack. You want to hide these items from TalkBack. In fact, you probably want to remove them entirely, but assume they should be on the screen. You can hide them from the accessibility service:

rootViewOfFragment.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS);

      

This will hide these views from TalkBack. This is a better solution than focusing on a specific element, as this is usually an accessibility violation in WCag 2.0. Although, if the elements on the screen are not completely hidden by your "top" fragment, that is also a violation and you should just leave things behind.

-1


source







All Articles