fix(ios): prevent black QuickType bar when using Magic Keyboard on iPad + Fix Keyboard on iOS 26#52
Conversation
…ad + Fix Keyboard on iOS 26
theproducer
left a comment
There was a problem hiding this comment.
@Daniele-rolli Hello! Thanks for this, we've been running into similar issues that you've detailed here. I left some comments and suggestions to your PR.
OS-pedrogustavobilro
left a comment
There was a problem hiding this comment.
@theproducer leaving a few comments of things I noticed.
|
@Daniele-rolli this PR was merged in So to apply the fix in its full capacity, one needs to add Thanks for the PR! Let us know if you have any questions. |
Context
On iPads with a hardware keyboard (e.g., Magic Keyboard), iOS still fires
UIKeyboardWillShow/UIKeyboardDidShownotifications even when no software keyboard is displayed. Only the QuickType suggestion bar appears at the bottom of the screen.Currently, Capacitor interprets these events as a "real keyboard," resizing the
WKWebViewand causing visual glitches such as a black bar below the webview.On iOS 26, a similar issue occurs with liquid glass the new keyboard is transparent with rounded edges, which can render a black box underneath.
iPad Example
iPhone Example
Solution
A height threshold guard was added in
onKeyboardWillShowandonKeyboardDidShowin the iOSKeyboardPlugin:If
UIDevice.userInterfaceIdiom == .padandkeyboardHeight < 100px:WKWebView.keyboardHeight = 0to indicate “no real keyboard.”Otherwise, continue with normal resizing behavior.
Additional improvements:
updateBackdropColorFromDOM.Benefits