fix(ios): prevent black QuickType bar when using Magic Keyboard on iPad + Fix Keyboard on iOS 26 #2403
+178
−93
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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