TabController: More sensible next tab auto-selection
This commit is contained in:
@@ -609,12 +609,8 @@ class BrowserViewController: UIViewController, WKNavigationDelegate, WKUIDelegat
|
||||
}
|
||||
|
||||
func tabPicker(_ picker: TabPickerViewController, willCloseTab tab: Tab) {
|
||||
// If closed tab is current tab, pick another one.
|
||||
// Dismiss picker if current tab is closed using the picker
|
||||
if tab == self.tab {
|
||||
if let nextTab = tabController.tabs.last(where: { $0 != tab }) {
|
||||
self.tab = nextTab
|
||||
}
|
||||
|
||||
picker.dismiss(animated: true, completion: nil)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,11 @@ class TabController
|
||||
tabs.remove(at: index)
|
||||
|
||||
if tabs.count > 0 {
|
||||
if index < tabs.count {
|
||||
activeTabIndex = index
|
||||
} else {
|
||||
activeTabIndex = tabs.count - 1
|
||||
}
|
||||
} else {
|
||||
_ = createNewTab(url: nil)
|
||||
activeTabIndex = 0
|
||||
|
||||
Reference in New Issue
Block a user