File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/products Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -626,8 +626,22 @@ class ProductListFragment :
626626 }
627627 }
628628
629+ // Some edge cases in product selection mode, like tapping the screen with 4 fingers or using TalkBack,
630+ // cause the product's onClick listener to gain focus over the selection tracker.
631+ // This quick fix will prevent the app from entering an unexpected status when the app is in selection mode.
632+ private fun shouldPreventDetailNavigation (remoteProductId : Long ): Boolean {
633+ if (viewModel.isSelecting()) {
634+ tracker?.let { selectionTracker ->
635+ if (selectionTracker.isSelected(remoteProductId)) selectionTracker.deselect(remoteProductId)
636+ else selectionTracker.select(remoteProductId)
637+ }
638+ return true
639+ }
640+ return false
641+ }
642+
629643 private fun onProductClick (remoteProductId : Long , sharedView : View ? ) {
630- if (viewModel.isSelecting( )) return
644+ if (shouldPreventDetailNavigation(remoteProductId )) return
631645 (activity as ? MainNavigationRouter )?.let { router ->
632646 if (sharedView == null ) {
633647 router.showProductDetail(remoteProductId, enableTrash = true )
You can’t perform that action at this time.
0 commit comments