fix(ios): prevent black QuickType bar when using Magic Keyboard on iPad + Fix Keyboard on iOS 26#52
Open
Daniele-rolli wants to merge 1 commit intoionic-team:mainfrom
Open
fix(ios): prevent black QuickType bar when using Magic Keyboard on iPad + Fix Keyboard on iOS 26#52Daniele-rolli wants to merge 1 commit intoionic-team:mainfrom
Daniele-rolli wants to merge 1 commit intoionic-team:mainfrom
Conversation
…ad + Fix Keyboard on iOS 26
theproducer
requested changes
Apr 8, 2026
Collaborator
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.
Comment on lines
+182
to
+191
| // Make WKWebView transparent | ||
| if (self.webView) { | ||
| self.webView.opaque = NO; | ||
| self.webView.backgroundColor = UIColor.clearColor; | ||
| self.webView.scrollView.backgroundColor = UIColor.clearColor; | ||
| } | ||
|
|
||
| // Force DOM color on load | ||
| [self updateBackdropColorFromDOM]; | ||
| } |
Collaborator
There was a problem hiding this comment.
Maybe instead of making the web view transparent, we should set the background color to one set in the Capacitor config?
NSString *configBackgroundColor = [[[self bridge] config] getString:@"backgroundColor"];
UIColor *backgroundColor = [self colorFromCssColorString:(NSString *)configBackgroundColor];
if (backgroundColor) {
[self forceBackdropColor:backgroundColor];
}
And if that's not set, maybe we then resort to pulling from the DOM body?
Comment on lines
+89
to
+93
| - (BOOL)shouldIgnoreResizeForHeight:(double)height { | ||
| if (![self isIPad]) return NO; | ||
| if (height <= 0.0) return NO; | ||
| return (height < QUICKTYPE_IGNORE_THRESHOLD); | ||
| } |
Collaborator
There was a problem hiding this comment.
If UIDevice.userInterfaceIdiom == .pad and keyboardHeight < 100px
Maybe we shouldn't have iPad be a differentiator in these checks? Theoretically someone could have a bluetooth keyboard connected to an iPhone...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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