Skip to content

fix(SystemBars): make safe-area-inset-x available on API <= 34 - #8424

Merged
theproducer merged 8 commits into
mainfrom
fix/RMET-5113
May 22, 2026
Merged

fix(SystemBars): make safe-area-inset-x available on API <= 34#8424
theproducer merged 8 commits into
mainfrom
fix/RMET-5113

Conversation

@theproducer

@theproducer theproducer commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

Description

This PR makes the custom injected safe-area-inset-x CSS variables available for Android devices on API <= 34, to make dealing with UI safe area logic more consistent across Android versions.

Change Type

  • Fix
  • Feature
  • Refactor
  • Breaking Change
  • Documentation

Rationale / Problems Fixed

fixes: #8394

Tests or Reproductions

Screenshots / Media

Platforms Affected

  • Android
  • iOS
  • Web

Notes / Comments

@djabif

djabif commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

Hi, thanks for this PR.
Looking forward to this merge 🙏🏻

@theproducer
theproducer requested review from a team April 9, 2026 16:02
@theproducer
theproducer marked this pull request as ready for review April 9, 2026 16:02
@luisbytes

Copy link
Copy Markdown
Contributor

I’m a bit concerned this last commit might clash with other plugins, like @capacitor-community/admob. I’ve been testing locally on Android <=14 (WebView < 140) and it works fine at first, but once the WebView updates, the banner gets hidden behind the navigation bar. This wasn't happening before this PR, so I feel like this change could lead to some serious compatibility issues with other plugins.

Android 14 Webview < 140 Android 14 Webview >= 140
Test Ad Test Ad

@theproducer

Copy link
Copy Markdown
Contributor Author

@luisbytes Do you have a test app that I can play around with and test some changes against?

@luisbytes

Copy link
Copy Markdown
Contributor

@theproducer
Hi, I've been a bit busy. I'll leave a repo tonight. I'll apply the patch from this PR with pnpm.

@luisbytes

Copy link
Copy Markdown
Contributor

@theproducer Upon reviewing, I noticed that the AdMob plugin adds padding based on the safe area, but only for Android 15+.

This leaves me wondering how plugins that need to display something natively on screen should handle the safe area: based on the WebView version or the Android version?

I'll also leave a Playground repository. I encountered more problems with the AdMob plugin on Android 15 and 16 with WebViews lower than 140 (it works fine in the latest WebView versions). The cause is this pull request: #8384. Downgrading to 8.2.0 fixes it.

In conclusion, I believe this pull request can be merged, but guidelines or suggestions should be established for plugins that want to display native objects on WebViews. For now, I applied this patch to the patch/admob branch of the admob plugin, adding native padding based on the webview version, just like the systembars plugin currently does. I tested it on Android 11, 14, 15, and 16 with Webview <140 and >140, and it works fine.

I'm considering whether to submit a PR to the AdMob plugin if these changes are mixed, applying padding based on the webview version.

@theproducer

Copy link
Copy Markdown
Contributor Author

@luisbytes I removed WindowCompat.setDecorFitsSystemWindows - I was using it to force - trigger setOnApplyWindowInsetsListener on non edge to edge devices, instead, im just going to return 0 for all non edge to edge supported versions.

That should fix the immediate issue with AdMob.

@luisbytes

Copy link
Copy Markdown
Contributor

@theproducer Thank you very much, I will try it. One question: will insetHandlingEnabled no longer be used to completely disable safe area handling?

@OS-pedrogustavobilro OS-pedrogustavobilro self-assigned this Apr 23, 2026
@luisbytes

Copy link
Copy Markdown
Contributor

@theproducer I ran a test, but nothing changed; the banner is broken. It's having double padding added to the bottom on Android 15+ with a Webview below 140. I updated the test repository.

Android 16Webview < 140 Android 16 Webview >= 140
Screenshot_1776976102 Screenshot_1776976309

After downgrading to @capacitor/android@8.2.0, everything works as it should.

@theproducer

Copy link
Copy Markdown
Contributor Author

@luisbytes Can you pull the latest from this branch and see if that fixes your double padding issue?

@luisbytes

luisbytes commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

@luisbytes Can you pull the latest from this branch and see if that fixes your double padding issue?

@theproducer I ran the test, and this last error is still occurring.

It should be noted that this only happens on Android 15+ and on Webview versions lower than 140.

I also updated the test repository. Applying the patch with the changes from this PR in the README contains instructions on how to run the app.

@theproducer

Copy link
Copy Markdown
Contributor Author

@luisbytes Hmm, I was able to reproduce your issue. However, for Android 15+ in the AdMob BannerExecutor.java, I tested just setting the bottomInset just to 0, and that seems to fix the issue:

Screenshot 2026-05-22 at 11 41 18 AM Screenshot 2026-05-22 at 11 41 11 AM

I obviously didn't do a full run of tests, but that might be all there is to it.

@luisbytes

Copy link
Copy Markdown
Contributor

Thanks, @theproducer. Maybe we should merge this and deal with the AdMob plugin later.

Should insetsHandling = disable remove all safe area handling performed by the SystemBar Plugin?

@theproducer

Copy link
Copy Markdown
Contributor Author

@luisbytes

Should insetsHandling = disable remove all safe area handling performed by the SystemBar Plugin?

Yes, it should, and I'll be dealing with that in the next PR.

@theproducer
theproducer merged commit e456de0 into main May 22, 2026
6 checks passed
@theproducer
theproducer deleted the fix/RMET-5113 branch May 22, 2026 18:39
cursor Bot pushed a commit to Cap-go/capacitor-plus that referenced this pull request Aug 13, 2026
…-area-inset-x` available on API <= 34 (#70)

* fix: injecting custom safe area insets for all Android versions

* fmt

* calling `WindowCompat.setDecorFitsSystemWindows`

* Setting safe area insets to zero

---------

Co-authored-by: Joseph Pender <joey.pender@outsystems.com>
Co-authored-by: Capacitor+ Bot <bot@capgo.app>
cursor Bot pushed a commit to Cap-go/capacitor-plus that referenced this pull request Aug 13, 2026
…equest bodies (#87)

* Release 8.3.2

* fix(cli): copy plugin files in CocoaPods projects (ionic-team#8467)

* Release 8.3.3

* chore(cli): update telemetry endpoint (ionic-team#8464)

* Release 8.3.4

* chore: format java code (ionic-team#8475)

* chore: format java code (ionic-team#8477)

* feat: add method getDouble to plugin config (ionic-team#7638)

Co-authored-by: jcesarmobile <jcesarmobile@gmail.com>

* fix(SystemBars): make `safe-area-inset-x` available on API <= 34 (ionic-team#8424)

* fix(http): support binary request bodies

* fix(http): support binary request bodies

(cherry picked from commit 5bfdb1d)

Co-authored-by: Martin DONADIEU <martindonadieu@gmail.com>

---------

Co-authored-by: Github Workflow (on behalf of markemer) <users.noreply.github.com>
Co-authored-by: jcesarmobile <jcesarmobile@gmail.com>
Co-authored-by: Alex J. <alexandre.jacinto@outsystems.com>
Co-authored-by: Robin Genz <mail@robingenz.dev>
Co-authored-by: Joey Pender <joey.pender@outsystems.com>
Co-authored-by: Angel J <78835633+iamanaws@users.noreply.github.com>
Co-authored-by: Capacitor+ Bot <bot@capgo.app>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
cursor Bot pushed a commit to Cap-go/capacitor-plus that referenced this pull request Aug 13, 2026
…e data type generic (#85)

* Release 8.3.2

* fix(cli): copy plugin files in CocoaPods projects (ionic-team#8467)

* Release 8.3.3

* chore(cli): update telemetry endpoint (ionic-team#8464)

* Release 8.3.4

* chore: format java code (ionic-team#8475)

* chore: format java code (ionic-team#8477)

* feat: add method getDouble to plugin config (ionic-team#7638)

Co-authored-by: jcesarmobile <jcesarmobile@gmail.com>

* fix(SystemBars): make `safe-area-inset-x` available on API <= 34 (ionic-team#8424)

* feat(cli): add experimental packageOptions (ionic-team#8471)

* feat(cli): capture ios_package_manager in telemetry (ionic-team#8482)

* fix(cli): revert live reload config on failure (ionic-team#8485)

* chore: fix typo in declarations.ts (ionic-team#8488)

* fix(SystemBars): respect `insetsHandling` disable (ionic-team#8481)

* fix(android): show only the requested system bar (ionic-team#8480)

Co-authored-by: Joey Pender <joey.pender@outsystems.com>
Co-authored-by: Pedro Bilro <pedro.gustavo.bilro@outsystems.com>
Co-authored-by: Mark Anderson <mark.anderson@outsystems.com>

* chore: Decrease timeout for CI jobs from 60 to 30 minutes (ionic-team#8476)

Co-authored-by: jcesarmobile <jcesarmobile@gmail.com>

* Release 8.4.0

* fix(cli): patch Capacitor SPM dependency version in plugins (ionic-team#8492)

Co-authored-by: Mark Anderson <mark.anderson@outsystems.com>

* fix(cli): make SPM dependency patch work on prereleases (ionic-team#8508)

* Release 8.4.1

* fix(core): make HttpResponse data type generic

* fix(docs): update HttpResponse examples to use generic type

* fix(core): make HttpResponse data type generic

(cherry picked from commit 525c6f7)

* fix(docs): update HttpResponse examples to use generic type

(cherry picked from commit 462a05a)

---------

Co-authored-by: Github Workflow (on behalf of markemer) <users.noreply.github.com>
Co-authored-by: jcesarmobile <jcesarmobile@gmail.com>
Co-authored-by: Alex J. <alexandre.jacinto@outsystems.com>
Co-authored-by: Robin Genz <mail@robingenz.dev>
Co-authored-by: Joey Pender <joey.pender@outsystems.com>
Co-authored-by: Minh Vu <vuhoangminh97@gmail.com>
Co-authored-by: Pedro Bilro <pedro.gustavo.bilro@outsystems.com>
Co-authored-by: Mark Anderson <mark.anderson@outsystems.com>
Co-authored-by: Mohamed Ben Makhlouf <med.b.makhlouf@gmail.com>
Co-authored-by: Capacitor+ Bot <bot@capgo.app>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
cursor Bot pushed a commit to Cap-go/capacitor-plus that referenced this pull request Aug 13, 2026
…ieStore observer so cookie sync works (#83)

* Release 8.3.2

* fix(cli): copy plugin files in CocoaPods projects (ionic-team#8467)

* Release 8.3.3

* chore(cli): update telemetry endpoint (ionic-team#8464)

* Release 8.3.4

* chore: format java code (ionic-team#8475)

* chore: format java code (ionic-team#8477)

* feat: add method getDouble to plugin config (ionic-team#7638)

Co-authored-by: jcesarmobile <jcesarmobile@gmail.com>

* fix(SystemBars): make `safe-area-inset-x` available on API <= 34 (ionic-team#8424)

* feat(cli): add experimental packageOptions (ionic-team#8471)

* feat(cli): capture ios_package_manager in telemetry (ionic-team#8482)

* fix(cli): revert live reload config on failure (ionic-team#8485)

* chore: fix typo in declarations.ts (ionic-team#8488)

* fix(SystemBars): respect `insetsHandling` disable (ionic-team#8481)

* fix(android): show only the requested system bar (ionic-team#8480)

Co-authored-by: Joey Pender <joey.pender@outsystems.com>
Co-authored-by: Pedro Bilro <pedro.gustavo.bilro@outsystems.com>
Co-authored-by: Mark Anderson <mark.anderson@outsystems.com>

* chore: Decrease timeout for CI jobs from 60 to 30 minutes (ionic-team#8476)

Co-authored-by: jcesarmobile <jcesarmobile@gmail.com>

* Release 8.4.0

* fix(cli): patch Capacitor SPM dependency version in plugins (ionic-team#8492)

Co-authored-by: Mark Anderson <mark.anderson@outsystems.com>

* fix(cli): make SPM dependency patch work on prereleases (ionic-team#8508)

* Release 8.4.1

* chore: run `npm run fmt` to fix lint errors (ionic-team#8516)

* fix(ios): retain WKHTTPCookieStore observer so cookie sync works

* fix(ios): retain WKHTTPCookieStore observer so cookie sync works

(cherry picked from commit 3fc41b8)

---------

Co-authored-by: Github Workflow (on behalf of markemer) <users.noreply.github.com>
Co-authored-by: jcesarmobile <jcesarmobile@gmail.com>
Co-authored-by: Alex J. <alexandre.jacinto@outsystems.com>
Co-authored-by: Robin Genz <mail@robingenz.dev>
Co-authored-by: Joey Pender <joey.pender@outsystems.com>
Co-authored-by: Minh Vu <vuhoangminh97@gmail.com>
Co-authored-by: Pedro Bilro <pedro.gustavo.bilro@outsystems.com>
Co-authored-by: Mark Anderson <mark.anderson@outsystems.com>
Co-authored-by: Mika Ruch <mika.ruch@zuehlke.com>
Co-authored-by: Capacitor+ Bot <bot@capgo.app>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
cursor Bot pushed a commit to Cap-go/capacitor-plus that referenced this pull request Aug 13, 2026
… truncation (#71)

* Release 8.3.2

* fix(cli): copy plugin files in CocoaPods projects (ionic-team#8467)

* Release 8.3.3

* chore(cli): update telemetry endpoint (ionic-team#8464)

* Release 8.3.4

* chore: format java code (ionic-team#8475)

* chore: format java code (ionic-team#8477)

* feat: add method getDouble to plugin config (ionic-team#7638)

Co-authored-by: jcesarmobile <jcesarmobile@gmail.com>

* fix(SystemBars): make `safe-area-inset-x` available on API <= 34 (ionic-team#8424)

* feat(cli): add experimental packageOptions (ionic-team#8471)

* feat(cli): capture ios_package_manager in telemetry (ionic-team#8482)

* fix(cli): revert live reload config on failure (ionic-team#8485)

* chore: fix typo in declarations.ts (ionic-team#8488)

* fix(android): range request truncation

* fix(android): range request truncation

(cherry picked from commit 6a9f325)

---------

Co-authored-by: Github Workflow (on behalf of markemer) <users.noreply.github.com>
Co-authored-by: jcesarmobile <jcesarmobile@gmail.com>
Co-authored-by: Alex J. <alexandre.jacinto@outsystems.com>
Co-authored-by: Robin Genz <mail@robingenz.dev>
Co-authored-by: Joey Pender <joey.pender@outsystems.com>
Co-authored-by: bwees <brandonwees@gmail.com>
Co-authored-by: Capacitor+ Bot <bot@capgo.app>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: CSS safe-area-inset-x, is not being applied on Android mobiles with API <= 34

5 participants