Skip to content

Fix PDF navigator content inset on iOS 27 - #900

Merged
mickael-menu merged 5 commits into
developfrom
fix/ios27
Sep 16, 2026
Merged

mickael-menu merged 5 commits into
developfrom
fix/ios27

Conversation

@mickael-menu

Copy link
Copy Markdown
Member

Various fixes for iOS 27:

  • PDFDocumentView now overrides safeAreaInsets to report its own computed insets, since PDFKit's paginated mode bypasses contentInset entirely on iOS 27.
  • Fixes the Test App failing to launch on iOS 27.
  • Fixes the Test App reader's presentation on iOS 27.

Since iOS 27, PDFKit lays out pages inside the PDFView's bounds inset by its safeAreaInsets instead of the full bounds. In paginated mode this bypasses the scroll view's contentInset entirely, so neither contentInsetAdjustmentBehavior = .never nor zeroing contentInset prevented the content from shifting when the navigation bar was shown.

PDFDocumentView now overrides safeAreaInsets to report the insets it already computes, so PDFKit lays the content out where the navigator asks. This also makes the pdfDocumentViewContentInset delegate hook effective in paginated mode on iOS 27, where it was previously ignored.

This behavior is undocumented. It was identified by measuring where PDFKit places a page in a paginated PDFView inside a navigation controller, across three runtimes: with a 390x844 view, a 612x792 page and the nav bar shown, the page lands centered in the full bounds on iOS 18.6 (y=172.9) and 26.4 (y=172.9), but centered in the safe area on iOS 27.0 (y=204.9). The measurement is recorded in the code comment.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The modal reader’s dismissal button needs an accessibility label for VoiceOver users.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Updates the PDF navigator and Test App for iOS 27 compatibility, including safe-area handling and modal reader presentation.

Changes:

  • Applies computed insets to PDFKit layouts.
  • Migrates the Test App to scene-based lifecycle handling.
  • Presents readers modally with dismissal controls.
  • Adjusts preferences spacing and documents the fix.
File summaries
File Summary
TestApp/Sources/SceneDelegate.swift Configures the scene window and handles publication URLs.
TestApp/Sources/Reader/ReaderModule.swift Presents readers full-screen modally. Nit (2 votes): remove stale back-button setup.
TestApp/Sources/Reader/Common/ReaderViewController.swift Adds reader dismissal control. Moderate (1 vote): provide a localized accessibility label.
TestApp/Sources/Reader/Common/Preferences/UserPreferences.swift Adjusts SwiftUI row spacing.
TestApp/Sources/Info.plist Registers the scene configuration.
TestApp/Sources/AppDelegate.swift Initializes app state and scene configuration.
Sources/Navigator/PDF/PDFDocumentView.swift Supplies computed safe-area insets to PDFKit.
CHANGELOG.md Documents the PDF inset fix.
Review details

Suppressed comments (1)

TestApp/Sources/Reader/Common/ReaderViewController.swift:59

  • This is an image-only bar button with no accessibility label, so VoiceOver may expose it as an unlabeled button even though it is the only way to dismiss the newly modal reader. Use a localized system close item (or set an explicit localized accessibilityLabel) so assistive-technology users can identify the action.
        navigationItem.leftBarButtonItem = UIBarButtonItem(image: UIImage(systemName: "xmark"), style: .plain, target: self, action: #selector(close))
  • Files reviewed: 8/8 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread TestApp/Sources/Reader/ReaderModule.swift
@mickael-menu
mickael-menu merged commit d135852 into develop Sep 16, 2026
5 checks passed
@mickael-menu
mickael-menu deleted the fix/ios27 branch September 16, 2026 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants