We are experiencing difficulties with keyboard navigation focus within a view contained inside a UIPageViewController.
The intended keyboard navigation sequence does not function as expected.
Expected Behavior:
- Pressing the Tab key once should move the focus to the
UIPageViewController,
allowing the use of the Up and Down arrow keys to navigate between pages. - Pressing the Tab key a second time should shift the focus outside the UIPageViewController
- Pressing the Tab key a third time should move the focus back to the UIPageViewController.
Actual Behavior: The focus does not shift as described above.
Have sent a sample Xcode project to Apple demonstrating the issue (unfortunately it doesn't allow me to attach the zipped project here for some reason).
STEPS TO REPRODUCE
- Set a breakpoint at viewDidAppear (line 44, MyViewController)
- Run the app, wait until it stops, and run the command in the lldb debugger
Command:
po UIFocusDebugger.checkFocusability(for: pager.viewControllers!.first!.view.subviews.first!)
Output:
The following issues were found that would prevent this item from being focusable:
- ISSUE: One or more ancestors have issues that may be preventing this item from being focusable. Details:
<_UIQueuingScrollView: 0x104826a00>:
- ISSUE: This view returns YES from -canBecomeFocused, which will prevent its subviews from being focusable.
<_UIPageViewControllerContentView: 0x103d07be0>:
- ISSUE: This view returns YES from -canBecomeFocused, which will prevent its subviews from being focusable.