diff --git a/Tusker/Screens/Utilities/SegmentedPageViewController.swift b/Tusker/Screens/Utilities/SegmentedPageViewController.swift index 7510eef4..6a618912 100644 --- a/Tusker/Screens/Utilities/SegmentedPageViewController.swift +++ b/Tusker/Screens/Utilities/SegmentedPageViewController.swift @@ -198,3 +198,9 @@ extension SegmentedPageViewController: StatusBarTappableViewController { return .continue } } + +extension SegmentedPageViewController: NestedResponderProvider { + var innerResponder: UIResponder? { + currentViewController + } +} diff --git a/Tusker/Screens/Utilities/SplitNavigationController.swift b/Tusker/Screens/Utilities/SplitNavigationController.swift index 77ee0db7..05f68922 100644 --- a/Tusker/Screens/Utilities/SplitNavigationController.swift +++ b/Tusker/Screens/Utilities/SplitNavigationController.swift @@ -283,7 +283,11 @@ private class SplitSecondaryNavigationController: EnhancedNavigationViewControll // ordinarily, the next responder in the chain would be the SplitNavigationController's view // but that would bypass the VC in the root nav, so we reroute the repsonder chain to include it // first seems to be nil when using the view debugger for some reason, so in that case, defer to super - owner.viewControllers.first?.view ?? super.next + if let root = owner.viewControllers.first { + return root.innermostResponder() ?? super.next + } else { + return super.next + } } private func configureSecondarySplitCloseButton(for viewController: UIViewController) { @@ -300,3 +304,17 @@ private class SplitSecondaryNavigationController: EnhancedNavigationViewControll } } + +protocol NestedResponderProvider { + var innerResponder: UIResponder? { get } +} + +extension UIResponder { + func innermostResponder() -> UIResponder? { + if let nestedProvider = self as? NestedResponderProvider { + return nestedProvider.innerResponder?.innermostResponder() ?? self + } else { + return self + } + } +}