LearnNewsExamplesConnect
Frontmatter
assigneesneo-gemini-maryam
createdAtNov 22, 2026, 5:16 PM
updatedAtNov 23, 2026, 2:48 AM
githubUrlhttps://github.com/neomjs/neo/issues/21973
authorneo-opus-ada
commentsCount1
parentIssue21140
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtNov 23, 2026, 2:48 AM

Six examples with their own theme toggle open on the catalog's scheme

neo-opus-ada
neo-opus-ada commented on Nov 22, 2026, 5:16 PM

Context

#21951 makes the catalog's ?theme= request open each example in the requested scheme, through resolveStartTheme in its app.mjs. Sophie's review of #21953 found six examples where that wiring breaks the example's own theme toggle: Calendar, Dialog, COVID, Big Data, Tree Big Data and Nested Record Fields. #21953 therefore leaves these six on dev's start path, and this ticket carries them.

The Problem

Each of the six toggles assumes the app starts on themes[0]:

  • Calendar and COVID flip on a hard-coded button label ("Theme Dark" / "Theme Light"). After a dark launch, the first click re-applies the dark theme and only flips the label.
  • Dialog toggles the body class with setBodyCls. Once the viewport carries its own theme class from resolveStartTheme, the viewport's class wins over the body's, so the switch shows nothing.
  • Big Data and Tree Big Data check their Dark radio by default, whatever the launch theme.
  • COVID also swaps its logo and map style from the label.
  • Nested Record Fields reads the current theme, but its control still starts from the default.

The Architectural Reality

  • src/util/Theme.mjs resolveStartTheme picks the start theme. A root viewport given theme mirrors it onto the body through Viewport#syncBodyTheme.
  • The toggles live in each example:
    • examples/calendar/basic/MainContainerController.mjs#onSwitchThemeButtonClick
    • examples/dialog/MainContainer.mjs#switchTheme
    • apps/covid/view/MainContainerController.mjs#onSwitchThemeButtonClick
    • examples/grid/{bigData,treeBigData}/ControlsContainer.mjs, the theme radios
    • examples/grid/nestedRecordFields/ViewportController.mjs#onSwitchThemeButtonClick
  • Design authority: #21835, "An example opens on the theme of the catalog that launched it". #21953's review sets the bar for the toggles.

The Fix

For each of the six:

  1. Start through resolveStartTheme.
  2. Initialize the toggle's label, icon, checked state and theme-bound chrome (COVID's logo and map style, Calendar's header color) from the theme the app actually started in.
  3. Make the toggle switch the viewport's theme from the current theme, not from a label or the body class, so body and viewport stay aligned.

Acceptance Criteria

  • After a dark launch (?theme=neo-theme-neo-dark) and after a light one, each control shows the state that matches the visible theme.
  • The first deliberate switch changes the visible theme in all six, including Dialog's default launch.
  • After every switch, body and viewport carry the same theme class.
  • A browser spec covers at least the dark-launch first switch and Dialog's default launch.

Out of Scope

The 15 examples #21953 wires, and any new theme control.

Related

Parent #21140. #21951 and #21953, where the review found it. #21835, the catalog theme link.

Live latest-open + closed sweep: checked latest 20 open (74 open, orange band; parent #21140) + open and closed search (theme toggle, resolveStartTheme, switchTheme; #21951 and #21835 are the source, and no other ticket covers these six toggles) at 2026-11-22T16:15Z; no equivalent found. A2A in-flight sweep: no claim on these examples. MC sweep: covered by the review that found it. Own-assignment sweep: none covers it.

unowned-rationale: claimable by any maintainer after the Engine 14 cut. Each toggle differs, and the fix wants a browser spec per toggle style.

Decision Record impact: none.

Origin Session ID: 1563f974-0d41-4096-a8cf-0a5cd5a12533

⚖️ Ada · @neo-opus-ada · Claude Opus 5.5 · Claude Code

tobiu referenced in commit e3bc7e5 - "feat(theme): examples open on the catalog's scheme (#21951) (#21953) on Nov 22, 2026, 6:24 PM