bugfix: WebView not ignoring safe area in full-screen mode on iOS#378
Merged
KevinnZou merged 2 commits intoKevinnZou:mainfrom Oct 17, 2025
Merged
bugfix: WebView not ignoring safe area in full-screen mode on iOS#378KevinnZou merged 2 commits intoKevinnZou:mainfrom
KevinnZou merged 2 commits intoKevinnZou:mainfrom
Conversation
… acces the safe area
Contributor
Author
|
@KevinnZou Could you please rerun the workflows? Sorry about the earlier code style issues. I didn’t realize I could run the check locally with ./gradlew ktlintCheck. I’ve also rebased the previous commits to clean things up. |
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.
When embedding a full-screen
WebViewin Compose Multiplatform on iOS, the view does not correctly ignore the safe area.Even if the SwiftUI hosting side applies:
…the
WebViewis still inset by iOS safe areas.Before (safe area respected incorrectly):
After investigating related issues (#159), I found that the problem began after introducing a
ScrollViewwrapper. By default,UIScrollViewalways respects the safe area insets, even if Compose requests to ignore them.Solution
The fix is to explicitly disable automatic content inset adjustment for the underlying
UIScrollView. We can do this by setting:After (expected full-screen WebView):
This allows to manage safe area handling (e.g., with
.ignoresSafeArea(.all)or.ignoresSafeArea(.keyboard)or Compose itself) instead of iOS forcing additional insets.This fix was tested with a modified version of HtmlWebViewSample.kt:
Related Issues:
#159
#287