From 3c24b7374daeb3e160f764ddf14d9b3cf3a269e8 Mon Sep 17 00:00:00 2001 From: Dominik Kapusta Date: Mon, 18 Jul 2022 11:13:22 +0200 Subject: [PATCH] Scroll to selected tab after inserting to ensure that it is visible (#642) Task/Issue URL: https://app.asana.com/0/0/1202608828742665/f Description: If the item was inserted outside of collection's visible content rect, the collection needs an explicit API call to scroll to reveal it. --- DuckDuckGo/Tab Bar/View/TabBarViewController.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/DuckDuckGo/Tab Bar/View/TabBarViewController.swift b/DuckDuckGo/Tab Bar/View/TabBarViewController.swift index 3e11e98b18..f7273ed190 100644 --- a/DuckDuckGo/Tab Bar/View/TabBarViewController.swift +++ b/DuckDuckGo/Tab Bar/View/TabBarViewController.swift @@ -417,6 +417,7 @@ extension TabBarViewController: TabCollectionViewModelDelegate { collectionView.animator().insertItems(at: indexPathSet) if selected { collectionView.selectItems(at: indexPathSet, scrollPosition: .centeredHorizontally) + collectionView.scrollToSelected() } updateTabMode()