LearnNewsExamplesConnect
Frontmatter
assigneesneo-gemini-julia
createdAtNov 15, 2026, 10:00 PM
updatedAtNov 16, 2026, 12:46 AM
githubUrlhttps://github.com/neomjs/neo/issues/21051
authorneo-gemini-julia
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtNov 16, 2026, 12:46 AM

container.Viewport: prevent nested Viewport instances from overwriting document.body classes and theme

Closed v14.0.0/archive-v14-0-0-chunk-2 bugaitestingcoreportal
neo-gemini-julia
neo-gemini-julia commented on Nov 15, 2026, 10:00 PM

Context & Problem Statement

In Portal Home E2E CI run 43727822062 (shard 3, jobs 132853556048 and 132885395596, observed on unrelated outside PR #21027 and surfaced via @neo-opus-grace's defect note), test/playwright/e2e/portal/HomeAudienceDoorsNL.spec.mjs:57 failed deterministically twice at line 156 (scrollHomeToReference(..., 'home-audience-doors', doors.id)):

  • AudienceDoors (#neo-container-12) stayed latched at rect.top = 58px with scroller.scrollTop = 842 for the final 8.1 seconds of the 10-second poll while scrollerRect.top was 45px (Math.abs(58 - 45) = 13 > 4).
  • Inspecting the Playwright CI trace (1-trace.trace + screencast frames) proves this is NOT a mere smooth-scroll timing issue, but a host document.body theme hijack triggered whenever an embedded Neo.code.LivePreview instantiates a subclass of Neo.container.Viewport:
    1. During the downward scroll from AudienceDoors to AiToolchain (#neo-container-28), IntersectionObserver hits Portal.view.home.parts.Helix (threshold: 0.6 in apps/portal/view/home/MainContainer.mjs:95-102) and invokes Helix#activate() (apps/portal/view/home/FeatureSection.mjs:111-121), which schedules await me.timeout(1000) before switching its embedded Neo.code.LivePreview (#neo-container-22) to activeView = 'preview'.
    2. When that timer lands during the subsequent upward scroll back to AudienceDoors, Neo.code.executor.Neo runs Helix.livePreviewCode (class MainView extends Viewport { static config = { className: 'Portal.view.MultiWindowHelix', showGitHubStarButton: false, theme: 'neo-theme-dark' } }) via container.add({module}) inside #neo-container-22.
    3. Neo.container.Viewport#onConstructed() (src/container/Viewport.mjs:96-104) unconditionally invokes DomAccess.applyBodyCls({cls: ['neo-body-viewport'], windowId}) and me.theme && me.syncBodyTheme(), and syncBodyTheme() (src/container/Viewport.mjs:134) only checks if (!me.applyBodyCls).
    4. Because container.Base#createItem (src/container/Base.mjs:470) assigns {parentId: container.id, theme: ...} rather than parentId: 'document.body', the nested LivePreview Viewport calls DomAccess.setBodyCls({add: ['neo-theme-dark'], remove: ['neo-theme-neo-dark', ...]}) on the host window's document.body.
    5. Flipping Portal's document.body from neo-theme-neo-dark to neo-theme-dark shrinks Portal.view.HeaderToolbar from 58px to 45px (moving scrollerRect.top from 58px to 45px and growing #neo-container-1 hero min-height: 100% from 842px to 855px after Blink already latched the smooth scroll at scrollTop = 842).

Design authority: src/container/Viewport.mjs:25-29 ("Assuming that a Viewport is the top level view of your app, and you want to mount it right away."), src/container/Viewport.mjs:107-127 (#18571 contract: a viewport that owns neo-body-viewport owns document.body theme synchronization), and resources/scss/src/container/Viewport.scss:1-4 (body > .neo-viewport).

(Contributor labels good first issue and help wanted are intentionally omitted because this defect actively flakes CI on unrelated PRs and is claimed for immediate fix by @neo-gemini-julia.)

Pre-Creation Verification Sweeps

  • (i) Live Open + Closed Queue (2026-11-15T20:59Z): 58 open issues in neomjs/neo (backlog band: moderate, 25-75). Open search "Viewport syncBodyTheme OR LivePreview theme OR HomeAudienceDoorsNL" returned 0 results. Closed search "Viewport syncBodyTheme OR LivePreview body theme" returned #18569, #19008, #8727 (plus reviewed #18571 conversation — none cover nested Viewport instances inside a parent container).
  • (ii) Recent Broadcast Scan: Reviewed latest 30 AGENT:* messages (list_messages through 20:57Z); contains Grace's defect-note sighting for HomeAudienceDoorsNL.spec.mjs:57 and zero competing [ticket-created] or [lane-claim] messages on Viewport / LivePreview / HomeAudienceDoorsNL.
  • (iii) Memory Core Sweep: query_raw_memories (nested Viewport LivePreview overwrites document.body theme syncBodyTheme HomeAudienceDoorsNL) found zero prior duplicates or architectural decisions touching nested Viewport body ownership.
  • (iv) Assignment Cap Check: 2 open self-assigned issues (#20987, #20671 epic); well within active cap.

Acceptance Criteria

  • AC-1: Neo.container.Viewport only applies 'neo-body-viewport' and publishes/resets document.body theme classes (syncBodyTheme) when it owns the root body surface (Boolean(this.applyBodyCls && this.parentId === 'document.body')), while keeping its own .neo-viewport component theme class intact when mounted inside a parent container (parentId !== 'document.body').
  • AC-2: Unit regression coverage in test/playwright/unit/container/ViewportBodyTheme.spec.mjs proves a Viewport added inside a Neo.container.Base (parentId !== 'document.body') invokes neither DomAccess.applyBodyCls nor DomAccess.setBodyCls on construction, theme change, or reset, while preserving all 8 existing root-Viewport (parentId === 'document.body') arms.
  • AC-3: Whitebox E2E coverage in test/playwright/e2e/portal/HomeAudienceDoorsNL.spec.mjs deterministically exercises embedded FeatureSection LivePreview (Helix) activation (theme: 'neo-theme-dark'), verifies document.body retains neo-theme-neo-dark and stage alignment holds cleanly, and passes 5 consecutive runs (--repeat-each=5).

Out of Scope

  • Changing LivePreview popout child-window (LivePreview.MainContainer) behavior: its app.mainView has parentId === 'document.body' in the child window and continues owning that child window's document.body theme.
  • Switching Portal's own Helix / Colors preview examples away from Viewport.

Related

  • #18571 (PR #18599 — root Viewport#syncBodyTheme() contract)
  • PR #21027 (outside PR where CI run 43727822062 surfaced the timeout)

Origin Session ID: 1f283c86-c55b-4aa5-a291-0cbb3786c302 Retrieval Hint: container.Viewport ownsBodySurface syncBodyTheme nested LivePreview parentId document.body