UIDocumentInteractionController keyboard trap

We are using UIDocumentInteractionController to preview a pdf. When you navigate on your phone with the hardware keyboard and it focuses on the pfd preview, there is no way we can reach the buttons in the toolbar anymore like the share and done button. Is this a bug or is there a way to get to the navigation/toolbars? iOS17.0 iPhone14 sim and real device.

Replies

You can make a little sample app to check this. Add a sample pdf to your project, like this one: https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf. In UIKit create a viewController in your storyboard with a button that will open a UIDocumentInteractionController like this:

@IBAction func openScreen() {
		let urlPath = Bundle.main.path(forResource: "dummy", ofType: "pdf")!
		let url = URL(filePath: urlPath)
		let interactionController = UIDocumentInteractionController(url: url)
		interactionController.delegate = self
		interactionController.presentPreview(animated: true)
		documentInteractionController = interactionController
	}
	
	func documentInteractionControllerViewControllerForPreview(_ controller: UIDocumentInteractionController) -> UIViewController {
		self
	}
	
	func documentInteractionControllerDidEndPreview(_ controller: UIDocumentInteractionController) {
		documentInteractionController = nil
	}

Then connect a hardware keyboard via Bluetooth, turn on Full Keyboard Access in your Accessibility Settings and try to navigate with TAB and arrow keys through the screen.

Hello, thanks for taking the time to write about this issue! Please take a few extra minutes and put these details along with a screen recording into a bug report so we can confirm this is tracked in our internal system. This helps immensely because we can see what you're experiencing on device and get vital information from diagnostic logs. You can file a report here: https://developer.apple.com/bug-reporting/

Once you do, feel free to reply with the Feedback ID number