From 8556ebe1fe70fa397fff3f3bb3c8feaacc24e254 Mon Sep 17 00:00:00 2001 From: Codrut Topliceanu <60002907+codrut-topliceanu@users.noreply.github.com> Date: Tue, 24 Nov 2020 09:11:27 +0200 Subject: [PATCH] [fenix] For https://github.com/mozilla-mobile/fenix/issues/16592 - Fix missing collection snackbar for a11y (https://github.com/mozilla-mobile/fenix/pull/16593) Set null anchor for snackbar when using a11y services --- .../fenix/tabtray/TabTrayDialogFragment.kt | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/org/mozilla/fenix/tabtray/TabTrayDialogFragment.kt b/app/src/main/java/org/mozilla/fenix/tabtray/TabTrayDialogFragment.kt index c0dcd4d385..7ed8f6a621 100644 --- a/app/src/main/java/org/mozilla/fenix/tabtray/TabTrayDialogFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/tabtray/TabTrayDialogFragment.kt @@ -72,14 +72,18 @@ class TabTrayDialogFragment : AppCompatDialogFragment(), UserInteractionHandler private lateinit var tabTrayDialogStore: TabTrayDialogFragmentStore private val snackbarAnchor: View? - get() = if (tabTrayView.fabView.new_tab_button.isVisible || - tabTrayView.mode != Mode.Normal - ) tabTrayView.fabView.new_tab_button - /* During selection of the tabs to the collection, the FAB is not visible, - which leads to not attaching a needed AnchorView. That's why, we're not only checking, if it's not visible, - but also if we're not in a "Normal" mode, so after selecting tabs for a collection, we're pushing snackbar - above the FAB, as we're switching from "Multiselect" to "Normal". */ - else null + get() = + // Fab is hidden when Talkback is activated. See #16592 + if (requireContext().settings().accessibilityServicesEnabled) null + else if (tabTrayView.fabView.new_tab_button.isVisible || + tabTrayView.mode != Mode.Normal + ) tabTrayView.fabView.new_tab_button + /* During selection of the tabs to the collection, the FAB is not visible, + which leads to not attaching a needed AnchorView. That's why, we're not only + checking, if it's not visible, but also if we're not in a "Normal" mode, so after + selecting tabs for a collection, we're pushing snackbar + above the FAB, as we're switching from "Multiselect" to "Normal". */ + else null private val collectionStorageObserver = object : TabCollectionStorage.Observer { override fun onCollectionCreated(title: String, sessions: List) {