diff --git a/iOS/RootSplitViewController.swift b/iOS/RootSplitViewController.swift index 9e7538cba..d47c752b1 100644 --- a/iOS/RootSplitViewController.swift +++ b/iOS/RootSplitViewController.swift @@ -85,7 +85,8 @@ final class RootSplitViewController: UISplitViewController { } let articlesToMark = coordinator.articles let title = NSLocalizedString("Mark All as Read", comment: "Command") - MarkAsReadAlertController.confirm(self, coordinator: coordinator, confirmTitle: title, sourceType: view as UIView) { [weak self] in + + let completion: () -> Void = { [weak self] in guard let self else { return } @@ -93,6 +94,14 @@ final class RootSplitViewController: UISplitViewController { self.coordinator.selectNextUnread() } } + + // Anchor to the Mark All as Read button (keyboard shortcut has no source view). + // + if let markAllAsReadButton = (viewController(for: .supplementary) as? MainTimelineModernViewController)?.markAllAsReadButton { + MarkAsReadAlertController.confirm(self, coordinator: coordinator, confirmTitle: title, sourceType: markAllAsReadButton, completion: completion) + } else { + MarkAsReadAlertController.confirm(self, coordinator: coordinator, confirmTitle: title, sourceType: view as UIView, completion: completion) + } } @objc func markAboveAsRead(_ sender: Any?) {