I can reproduce this bug in my app and in some other apps, including Apple Notes:
1. Start with the app running on an iPad with a Bluetooth keyboard.
2. Put Safari to the right of the app in split view.
3. Make sure the app to the left is the active app and is responding to keyboard input.
4. Move the split view divider all the way to the right, making the app on the left the only one on the screen.
Result: The app remaining on the screen does not see keyboard commands until I touch the screen. Holding the command key does not bring up the list of keyboard shortcuts.
I see this bug in a few apps, but not in all. It appears to me that the appropriate subview is the first responder, but it is not receiving UIKeyCommands.
This code from a sample app demonstrates the problem. If I create a sample app with this view controller and go through the process above, when I return to the app I will not be able to scroll the webview with the Bluetooth keyboard.
class ViewController: UIViewController {
var webView: WKWebView?
override func viewDidLoad() {
super.viewDidLoad()
let webView = WKWebView(frame: self.view.bounds)
webView.translatesAutoresizingMaskIntoConstraints = false
webView.load(URLRequest(url: URL(string: "https://www.goldenhillsoftware.com/unread/")!))
self.view.addSubview(webView)
self.view.addConstraint(webView.leftAnchor.constraint(equalTo: self.view.leftAnchor))
self.view.addConstraint(webView.rightAnchor.constraint(equalTo: self.view.rightAnchor))
self.view.addConstraint(webView.topAnchor.constraint(equalTo: self.view.topAnchor))
self.view.addConstraint(webView.bottomAnchor.constraint(equalTo: self.view.bottomAnchor))
webView.becomeFirstResponder()
self.webView = webView
}
}Any idea how I can avoid this in my app?
Thanks.
John