From 8dae63f2c7fe7874845787e7c78d195b264fd801 Mon Sep 17 00:00:00 2001 From: Tony Li Date: Wed, 19 Aug 2026 11:44:48 +1200 Subject: [PATCH] Present the publish sheet as a form sheet in regular width The publish sheet used a custom 526pt detent everywhere. UIKit only marks a sheet as accessibility-modal while it rests at the large detent, and over the editor's stacked modal presentations that left Voice Control unable to reach any of the sheet's elements ("Show numbers" showed nothing, CMM-2216). The partial-height sheet also added little on large screens, where it already rendered as a centered card. Keep the detented sheet in compact width and present a plain form sheet in regular width, matching how Post Settings is presented from the editor. Verified with Voice Control on an iPad running iPadOS 26.6. --- .../PublishPostViewController.swift | 31 ++++++++++++++----- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/WordPress/Classes/ViewRelated/Post/Publishing/PublishPostViewController.swift b/WordPress/Classes/ViewRelated/Post/Publishing/PublishPostViewController.swift index d70e0aef88b1..7d0bb2477dbf 100644 --- a/WordPress/Classes/ViewRelated/Post/Publishing/PublishPostViewController.swift +++ b/WordPress/Classes/ViewRelated/Post/Publishing/PublishPostViewController.swift @@ -51,10 +51,7 @@ final class PublishPostViewController: publishVC.onCompletion = completion // - warning: Has to be UIKit because some of the `PostSettingsView` rows rely on it. let navigationVC = UINavigationController(rootViewController: publishVC) - navigationVC.sheetPresentationController?.detents = [ - .custom(identifier: .medium, resolver: { _ in 526 }), - .large() - ] + configureSheetPresentation(of: navigationVC, from: presentingViewController) presentingViewController.present(navigationVC, animated: true) } @@ -90,10 +87,7 @@ final class PublishPostViewController: completion(result) } let navigationVC = UINavigationController(rootViewController: publishVC) - navigationVC.sheetPresentationController?.detents = [ - .custom(identifier: .medium, resolver: { _ in 526 }), - .large() - ] + configureSheetPresentation(of: navigationVC, from: presentingViewController) presentingViewController.present(navigationVC, animated: true) } @@ -121,6 +115,27 @@ final class PublishPostViewController: } } +/// Configures how the publishing sheet is presented based on the screen size. +/// +/// In compact width, the sheet opens at a partial-height detent that can be +/// dragged to full height. In regular width, it is presented as a plain form +/// sheet instead. A sheet resting at a non-large detent is not marked as +/// accessibility-modal by UIKit, which left Voice Control unable to reach any +/// of the sheet's elements when presented over the editor (CMM-2216). +private func configureSheetPresentation( + of navigationVC: UINavigationController, + from presentingViewController: UIViewController +) { + if presentingViewController.traitCollection.horizontalSizeClass == .regular { + navigationVC.modalPresentationStyle = .formSheet + } else { + navigationVC.sheetPresentationController?.detents = [ + .custom(identifier: .medium, resolver: { _ in 526 }), + .large() + ] + } +} + struct PublishPostView: View { @ObservedObject var viewModel: ViewModel var uploadsViewModel: PostMediaUploadsViewModel?