Skip to content

Follow-ups for #8535: css default, doc annotations, EdgeToEdge.enable - #1

Open
kklem0 wants to merge 12 commits into
tafelnl:fix/resolve-issues-with-safe-areafrom
kklem0:safe-area-8535-followups
Open

Follow-ups for #8535: css default, doc annotations, EdgeToEdge.enable#1
kklem0 wants to merge 12 commits into
tafelnl:fix/resolve-issues-with-safe-areafrom
kklem0:safe-area-8535-followups

Conversation

@kklem0

@kklem0 kklem0 commented Aug 2, 2026

Copy link
Copy Markdown

Follow-ups on top of fix/resolve-issues-with-safe-area (ionic-team#8535), one commit per finding, from reviewing the branch against main and the linked issues. Commits are independent, feel free to cherry-pick.

  1. fix(android): keep css as the runtime default for insetsHandling. initSystemBars() resolves the option against native, while declarations.ts and system-bars.md in this same branch document the default as css, and the review discussion proposes flipping the default only in Capacitor 9. Apps that never set the option and style against the injected --safe-area-inset-* variables without an env() fallback would silently lose those variables in a minor release.

  2. docs(cli): restore the style option's DEFAULT default annotation. Its @default tag was changed to 'css' alongside the insetsHandling edits; the runtime default is unchanged.

  3. docs: correct initialViewportFitValueHint default annotation and wording. It is a string option resolved against an empty string at runtime, so @default false was misleading, and there was a small typo ("set this value is to").

  4. fix(android): enable edge-to-edge whenever SystemBars owns insets. The rewritten listener assumes an edge-to-edge window on every Android version (no more VANILLA_ICE_CREAM gate), but the system only guarantees that on API 35+, and core never opts older versions in. That gap is what fix(SystemBars): avoid extra view padding on API <= 34 ionic-team/capacitor#8439 was compensating for, it is the mechanism behind the API <= 34 double IME compensation described in fix(SystemBars): avoid extra IME padding on API <= 34 in insets passthrough ionic-team/capacitor#8528, and it is why the reporter of [Bug]: Capacitor v8.3.0 extra gray space when keyboard is visible ionic-team/capacitor#8525 still saw a navigation-bar-sized gap on Android 10 with this branch until manually adding EdgeToEdge.enable(this) to MainActivity (a required setup step in the community plugin docs, with no core equivalent). Calling EdgeToEdge.enable() from the plugin when insetsHandling is not disable makes the branch self-consistent out of the box, keeps disable as the full opt-out, and needs no template change; apps that already call it themselves are unaffected. This also matches your own review note about adding it to BridgeActivity.onCreate; doing it in the plugin ties it to the plugin configuration instead. If you would rather keep it a documented manual step, take commits 1 to 3 and drop this one.

Compile-checked with gradlew compileDebugJavaWithJavac. Unrelated: the red lint job on ionic-team#8535 trips on HttpRequestHandlerTest.java formatting that was fixed on main by ionic-team#8542, so a rebase onto current main clears it.

tafelnl and others added 12 commits July 21, 2026 14:58
initSystemBars() resolved the option against INSETS_HANDLING_NATIVE
while the documentation added in this branch (cli/src/declarations.ts
and core/system-bars.md) still states the default is css, and the
review discussion proposes flipping the default only in Capacitor 9.

Apps that never set insetsHandling and style against the injected
--safe-area-inset-* variables without an env() fallback would silently
lose those variables in a minor release. Keep css as the default until
the major, matching the documented behavior.
The @default tag of SystemBars.style was changed to 'css' alongside the
insetsHandling edits. The runtime default is unchanged (DEFAULT), so
restore the original annotation.
The option is a string ('auto' | 'contain' | 'cover') resolved against
an empty string at runtime, so document the default as undefined rather
than false, and fix a small typo in the description (in both
declarations.ts and system-bars.md).
The rewritten insets listener assumes an edge-to-edge window on every
Android version: both branches pad the decor view (or pass real insets
through) with no API level gate. The system only guarantees edge-to-edge
on API 35+, and nothing in core opts the window in on older versions, so
the listener runs outside its design assumptions there.

That mismatch is what the removed VANILLA_ICE_CREAM gate
(ionic-team#8439) was compensating for, it is the mechanism
behind the API <= 34 double IME compensation described in
ionic-team#8528, and it is why the reporter of
ionic-team#8525 still saw a navigation bar sized gap on
Android 10 after applying this branch, until manually adding
EdgeToEdge.enable(this) to MainActivity. The community safe-area plugin
this branch derives from documents EdgeToEdge.enable as a required
manual setup step; core has no equivalent documentation or call.

Call EdgeToEdge.enable() from the plugin when insetsHandling is not
disable, so the window state matches the listener's assumptions out of
the box. disable keeps the window untouched for apps that manage insets
themselves. Doing this in the plugin rather than in BridgeActivity ties
the behavior to the plugin configuration and needs no template change.
Apps that already call EdgeToEdge.enable(this) themselves are
unaffected, the call is idempotent.
Comment thread cli/src/declarations.ts
* This option is only supported on Android.
*
* @default false
* @default undefined

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, good catch Claude


warnAboutUnsupportedConfigurationValues();

if (!INSETS_HANDLING_DISABLE.equals(insetsHandling)) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I proposed this here. Strictly speaking it's a breaking change. So I didn't include it just yet. If we do though, I think it might be better to call in inside BridgeActivity.onCreate. Because I guess that's where you most expect it to be

@tafelnl
tafelnl force-pushed the fix/resolve-issues-with-safe-area branch from 7abde6f to 9b35343 Compare August 4, 2026 14:22
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.

2 participants