Skip to content

[Bug]: SystemBars injects non-zero --safe-area-inset-* when the WebView is not edge-to-edge (regression in 8.5.2) #8623

Description

@AlyssonT

Capacitor Version

Capacitor Version

@capacitor/cli: 8.5.2
@capacitor/core: 8.5.2
@capacitor/android: 8.5.2

Last working version: 8.5.1.

Current Behavior

When the window is not edge-to-edge (targetSdk <= 34, or any app on Android <= 14 without an edge-to-edge opt-in), the system already places the window below the status and navigation bars, so the WebView never covers them. 8.5.2 injects the system bar insets as --safe-area-inset-* anyway, so any layout reading those variables reserves the space a second time. env(safe-area-inset-*) correctly reports 0px at the same moment.

Emulator, Android 16 (API 37), WebView 145, 1080x2400, dpr 2.625. Same app, only the Capacitor version changed:

8.5.1 8.5.2
WebView view geometry screenY=63, height 2274 screenY=63, height 2274
--safe-area-inset-top / -bottom not injected 24px / 24px
env(safe-area-inset-top) / -bottom 0px / 0px 0px / 0px
resulting body padding 0px / 0px 24px / 24px

Also reproduced on a physical device (Android 13, WebView 151): injected 34px / 47px with the WebView already positioned 34dp below the top and 47dp above the bottom.

Expected Behavior

SystemBars should only report insets the WebView actually has to clear. With the window not edge-to-edge and the WebView already inside the safe area, the injected variables should be zero, as in 8.5.1.

Project Reproduction

https://github.com/AlyssonT/capacitor-safe-area-repro

Additional Information

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions