Android edge-to-edge: embrace SDK 35 enforcement and CSS safe-area insets#2283
Android edge-to-edge: embrace SDK 35 enforcement and CSS safe-area insets#2283myieye wants to merge 2 commits into
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
C# Unit Tests165 tests 165 ✅ 21s ⏱️ Results for commit a26113c. ♻️ This comment has been updated with latest results. |
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
Android 15 (SDK 35) enforces edge-to-edge layouts and the old `OptOutEdgeToEdgeEnforcement` attribute in styles-v35 was causing `env(safe-area-inset-*)` to return 0 inside the BlazorWebView. Replace the opt-out with a new `AndroidEdgeToEdgeInsets` class that listens to `WindowInsetsCompat` callbacks and injects the real inset values as CSS custom properties (`--safe-area-inset-*`) into the WebView via JavaScript. MainActivity is updated to wire up the listener instead of relying on the deprecated opt-out style. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add `viewport-fit=cover` to the HTML meta viewport tag so the WebView renders into the full screen including the notch/status-bar area. Then apply the `--safe-area-inset-*` CSS custom properties (set by `AndroidEdgeToEdgeInsets`) throughout the viewer: - `app.css`: root vars + utility classes for padding/margin insets - `App.svelte` / `ShadcnProjectView.svelte`: top/bottom padding on main content areas - `sidebar.svelte` / `sidebar-provider.svelte`: fixed positioning accounts for top inset so the sidebar doesn't underlap the status bar - `sonner.svelte`: toaster offset respects bottom inset - `dialog-content.svelte`, `drawer-content.svelte`, `alert-dialog-content.svelte`, `sheet-content.svelte`: overflow and padding adjustments so content isn't clipped behind system bars - `fab-container.svelte`: FAB raised above the bottom nav bar - `HomeView.svelte`: home view padding Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
417acf9 to
a26113c
Compare
Android's
windowOptOutEdgeToEdgeEnforcementgot deprecated and we can't use it anymore. #2285 implemented the quick fix.(The issue is essentially that Android wants our app to feel responsible for every pixel on the entire screen (aka edge-to-edge) instead of just the "safe" areas.
This PR is the pro version. It's more complicated, but also more attractive than both #2285 AND the behaviour we had before that. With this PR we get the benefits of both:
The problem with this PR is just that it's somewhat non-trivial.