Skip to content

Background layer: persistent content beneath every screen - #37

Merged
shanerbaner82 merged 3 commits into
mainfrom
feat/background-layer
Aug 4, 2026
Merged

Background layer: persistent content beneath every screen#37
shanerbaner82 merged 3 commits into
mainfrom
feat/background-layer

Conversation

@shanerbaner82

Copy link
Copy Markdown
Contributor

A chrome contributor + native root hosts that render arbitrary content (a map, a video, a canvas) beneath the screen content at a stable structural position — mounted once at the root, so it persists across tab switches and pushes instead of re-initializing per screen.

  • Discovery mirrors the floating overlay: layouts opt in with HasBackgroundLayer / a backgroundLayer() builder; screens override via backgroundLayerOverride() or hide with hidesBackgroundLayer.
  • The background_layer sentinel element travels in the published tree; iOS (NativeUIBackgroundLayerHost.swift) and Android (NativeUIBackgroundLayerHost.kt) hosts registered on core's NativeRootHostRegistry pull it out and compose it under the content (tabs-hosted variant handled on Android).

Draft — in-flight feature branch packaged from the working tree so it has a home; review/finish at leisure.

shanerbaner82 and others added 3 commits August 4, 2026 13:01
A chrome contributor + native root hosts that render arbitrary content
(a map, a video, a canvas) BENEATH the screen content at a stable
structural position, mounted once at the root so it persists across tab
switches and pushes instead of re-initializing per screen.

Same discovery shape as the floating overlay: layouts opt in with
HasBackgroundLayer / a backgroundLayer() builder, screens can override
via backgroundLayerOverride() or hide with hidesBackgroundLayer. The
sentinel background_layer element travels in the published tree; the
iOS and Android hosts registered on core's NativeRootHostRegistry pull
it out and compose it under the content.
…e hand-off

The registration passed a hostedByChrome argument the host composable
never declared (compile error), and a leftover bisect experiment
composed content first, drawing the layer OVER the screen. The chrome
hand-off returns when core's tabs Scaffold actually hosts the layer.

Also: InteractsWithBackgroundLayer trait mirroring the overlay/drawer
pattern, the floating-overlay docblock reunited with its method, and a
BackgroundLayerTest mirroring FloatingOverlayTest.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@shanerbaner82

Copy link
Copy Markdown
Contributor Author

Pushed fixes from review: the Android host now compiles (dropped the hostedByChrome argument that NativeUIBackgroundLayerHost never declared — the chrome hand-off can return alongside the core tabs work), the leftover bisect experiment is gone so the layer renders beneath content again, InteractsWithBackgroundLayer ships mirroring the overlay/drawer traits, the floating-overlay docblock is back on its method, and BackgroundLayerTest covers the builder, sentinel, and all three opt-out spellings (suite: 207 passing).

Still blocked before undrafting: Android touch routing under tabs needs the core-side change (hosting the layer inside the Scaffold body) that currently lives uncommitted in the core working tree, and iOS tabs have no transparency coordination yet (background_layer is unknown to core's iOS resources — an opaque TabView screen hides the layer).

🤖 Generated with Claude Code

@shanerbaner82

Copy link
Copy Markdown
Contributor Author

Field note from building a demo against this branch: the iOS transparency gap applies to NavigationStack chrome too, not just tabs — core folds root hosts around the whole tree outside the nav container (SwiftUINodeRenderer.swift:51NativeRootHostRegistry.wrap), so any screen with native chrome paints the system background over the layer and it never shows. A chrome-less screen (layout with usesNativeChrome: false, no nav bar) displays the layer correctly. Worth either documenting chrome-less as the supported iOS shape for now, or coordinating transparency from the stack/tab renderers when a background_layer sentinel is present (the Android LocalBackgroundLayerPresent pattern).

🤖 Generated with Claude Code

@shanerbaner82
shanerbaner82 marked this pull request as ready for review August 4, 2026 18:56
@shanerbaner82
shanerbaner82 merged commit 4efe568 into main Aug 4, 2026
3 checks passed
@shanerbaner82
shanerbaner82 deleted the feat/background-layer branch August 4, 2026 18:56
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.

1 participant