-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat(android): add adjustMarginsForEdgeToEdge configuration option #7885
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
Just a note that the
|
ba56bb9
to
f764a38
Compare
android/capacitor/src/main/java/com/getcapacitor/CapacitorWebView.java
Outdated
Show resolved
Hide resolved
android/capacitor/src/main/java/com/getcapacitor/CapacitorWebView.java
Outdated
Show resolved
Hide resolved
android/capacitor/src/main/java/com/getcapacitor/CapacitorWebView.java
Outdated
Show resolved
Hide resolved
android/capacitor/src/main/java/com/getcapacitor/CapacitorWebView.java
Outdated
Show resolved
Hide resolved
@dpogue and other interested parties:
Capacitor 8 will for sure deal with that directly, however, setting |
I'm with you there - seems that we're gonna have to fix a group of people no matter what. Either the people that are currently broken, or the people that fixed it with some hacky-ness. I'm of two minds. I feel weird not default fixing a bug because people might have fixed it a weird other way, but I also feel weird breaking people who thought they were fixed. I think we might want to use disable for 7 just because it is a behavior change, but I don't love it. |
Is there anything here that will break if the WebView does start handling safe-area-insets properly? My guess is that because this is using LinearLayout margins outside the WebView it'll be fine, but wanted to ask |
I completely agree with you, that error should not have appeared with capacitor v7, it is an unexpected behavior. In a project I managed to solve it with CSS using a third-party plugin but I did not release it to the public. I'm still waiting for the fix from the ionic team to update a month after the stable release of v7, this error is still present. |
yeah... I'm asking because I'm trying to get this fixed in Android WebView, and there are concerns about breaking apps that are already working around these problems (weighed against apps that are already broken because of these problems). So I want to make sure that workarounds like the changes in this PR won't cause more trouble if the WebView starts behaving properly. |
I would assume that people using their own css variables for safe areas would be doing something like I would also assume that your fix would return 0 for the safe areas when the WebView is avoiding the safe areas as when using |
Yes, please disable it by default on Capacitor 7, as it would be a breaking change now and change that with Capacitor 8. |
android/capacitor/src/main/java/com/getcapacitor/CapacitorWebView.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've noticed that force
also adjusts margins on Android 14 and probably other older versions, not sure if that's expected/desired.
It's not clear by the definition since it only talks about "settings" and not about Android versions, but I personally like that it does it as we have had complaints in the past about devices with notches or similar not behaving correctly (it was related to status bar plugin, but good to have this option in the core)
Thanks! Yeah, I though "force" should do what it implies. All the time. |
@markemer How can I get this working? I have installed Capacitor 7.1.0 and tried setting adjustMarginsForEdgeToEdge to 'auto' and even 'force', but it doesn’t do anything. The margins are not applied. |
I should also add the corresponding documentation, and I think it would be good to also add it to the upgrade guide since this fixes unexpected behavior in Capacitor v7 |
Hi,
If I understand well, this attribute permits to opt out the edge-to-edge (thus disable it) and keep the same behavior than before. Therefore, we have to add margin right? no? Kr |
The attribute already does its own handling by itself, so the plugin will do nothing if the attribute is true to not conflict, unless you use "force", in that case the plugin will do its own handling, which might cause issues since it would be handled in two different ways. |
Thanks for the clarification @jcesarmobile . I ended up with the same understanding after your comment. However, why with My Samsung with Android 13 only shows correctly with force. However, as you stated, the margin can be handled twice in this scenario. Kr. |
No description provided.