[Bug] [a11y] On Onboarding the focus jumps on the header of the screen instead of Theme card after a theme is selected
Prerequisites
Make sure to have a clean profile.
Steps to reproduce
- Enable Talkback.
- Open Firefox Preview and go to Theme card.
- Tap on Dark theme.
- Double tap on Dark theme to activate it.
Expected behavior
The theme is changed, and the focus remains on Theme card.
Actual behavior
The theme is changed, but the focus moves to the search bar. The same behavior is encountered if Automatic selected, or Light theme.
Device information
- Android device: OnePlus 5T (Android 9)
- Fenix version: 6/13

┆Issue is synchronized with this Jira Task
After doing some research on the issue, it seems that the focus change with the talkback activated is caused by the activity recreation after setting the new theme thru the function OnboardingThemePickerViewHolder.setNewTheme(mode: Int).
Inside the mentioned function is a call to AppCompatDelegate.setDefaultNightMode(mode) where its documentation states "If this method is called after any host components with attached AppCompatDelegates have been 'started', a uiMode configuration change will occur in each. This may result in those components being recreated, depending on their manifest configuration."
Additionally, the uiMode configuration change is not set inside the manifest.
I would like to have some technical input on how to address the situation because it is the expected behavior from the OS. There are some alternatives such as forcing the ´uiMode´ on the manifest but I believe it requires further discussion.
Technical Details
- Device: Android Emulator
- OS : Android 7.1.1 API 25
- Talkback version: Android Accessibility Suite 7.3.0.239841594
- Firefox Preview Version: 1.0.11926
I think we could check if the theme chooser was focused and store that in a viewmodel or shared preferences here. If the chooser was focused, it should be refocused when the activity is created again.
This issue is still reproducible on OnePlus 5T (Android 9) on the latest Nightly build 10/18 (#12910609).
Looked a bit into this one, de-assigned myself for a few reasons:
- Seems like a majority of the android community highly opposes any accessibility auto-focus (maybe the accessibility users know that changes to the page move the focus on the top?)
- Even disregarding the first reason, at this moment, I can't find a way to programatically set the accessibility focus WITHOUT the actual talk-back voice (which makes it a bit weird for the user to hear again that the focus is set on the theme selector)
- Furthermore, since Talkback scans the screen and then traverses the children, it takes some time to set its focus on the first element. So setting the focus accessibility event will get overridden if we do it too early, and using delays could lead to inconsistent behaviour on different phones
There might be a way by changing the traversal order of this element to before the first focusable element in the activity, but again, the first 2 reasons still apply
I was able to reproduce this issue, again, on 3.0.0-beta.3 build. After selecting a theme, the selection jumps on the header of the screen selecting the element that is displayed there. Reproduced with LG G7 Fit (Android 8.1).
This is reproducible with Talkback disabled, when the dark theme is selected. Not reproducible when the theme is changed from automatic to light. Nightly build 01/04.

Hi, issue is still reproducible with Sony Xperia Z5 (Android 7) on Firefox Nightly 4/22. Note:
- After activating/enabling dark theme the talk back starts from the private browsing button. The same outcome is present when selecting white theme.
I was able to reproduce this issue on the latest Nightly build from 9/10 with HTC 10 (Android 8). The focus jumped on the three-dot menu after selecting the dark theme.
Reproducible on beta 86.0.0-beta.5 with Talkback on, with Xiaomi Mi 8 Lite (Android 9).
This issue reproduces on the Beta 90.0.0-beta.3 build with Talkback on, on OnePlus 5T (Android 10).
I was able to reproduce this issue on the 11/2 Nightly build with Sony Xperia Z5 Premium (Android 7.1.1).
See: https://github.com/mozilla-mobile/fenix/issues/17373 This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This is no longer available since the "Choose your theme card" is the first displayed. Closing as worksforme.