Closed theproducer closed 22 hours ago
Just remembered this initialFocus
configuration option we added for Android, maybe we should add it for iOS too?
Using
self.webView?.becomeFirstResponder()
in the same line wereself.becomeFirstResponder()
was also seems to work fine without the addition of theviewDidAppear
override.Rethinking this comment, the
viewDidAppear
method will be called in apps that embed theCAPBridgeViewController.swift
whenever it appears, so putting the line there will make the WebView to regain focus, so looks like a better place thanviewDidLoad
.@Steven0351 thoughts?
Yeah - viewDidAppear
is probably better - but, I don't want to break Portal, et. al.
Using
self.webView?.becomeFirstResponder()
in the same line wereself.becomeFirstResponder()
was also seems to work fine without the addition of theviewDidAppear
override. Rethinking this comment, theviewDidAppear
method will be called in apps that embed theCAPBridgeViewController.swift
whenever it appears, so putting the line there will make the WebView to regain focus, so looks like a better place thanviewDidLoad
. @Steven0351 thoughts?Yeah -
viewDidAppear
is probably better - but, I don't want to break Portal, et. al.
Nothing in here would affect Portals at all, so it's all good 👍, +1 for viewDidAppear
Not portals but embedded Capacitor, not sure what his name is nowadays.
I think this should be behind a initialFocus
configuration option like on Android and also make a common initialFocus
configuration option for both platforms as we do for some other settings so can be set globally or per platform, but the common one could be kept out of this PR since this is about iOS.
Fixes a focus issue (reproduction) caused when the webView is not the first responder. CAPBridgeViewController's
self.becomeFirstResponder()
was being called duringviewDidLoad
, before the view's window is set, which had no effect.