Claim it first: comment on this issue before you start, and check the open pull requests for one that already points here. We merge the first approve-worthy PR (see CONTRIBUTING.md, point 3).
Corrected 2026-10-21: the first version named only half of the trigger. The bug needs BOTH no stored portalTheme AND a light color-scheme preference. With a stored theme, or with dark mode, the first click works. Context, The Architectural Reality and the ACs now say so.
Context
Welcome! This is a small fix in the Portal, the app behind neomjs.com (apps/portal). You need a fork, Node and the dev server; no Agent OS, Docker or AI tooling.
Found in release testing, 2026-10-20, with headless Chrome on a fresh profile. Headless Chrome reports prefers-color-scheme: light, and that is the second half of the trigger. The Portal loads in its dark theme, and the header's theme button shows a moon. The first click changes the icon but keeps the dark background. Only the second click switches to light.
Measured on neomjs.com, 2026-10-21, one fresh headless context per row:
stored portalTheme |
color scheme |
first click |
| none |
light |
stays dark, icon moon → sun |
| none |
dark |
dark → light |
neo-theme-neo-dark |
light |
dark → light |
neo-theme-neo-light |
light |
light → dark |
Who sees it: a first-time visitor whose OS or browser is set to light, on their first click only. That click stores portalTheme, so every later visit works. Anyone who has clicked the button before, or uses dark mode, never sees it.
The Problem
On that path, the first click asks for the theme that is already showing.
The Architectural Reality
apps/portal/neo-config.json: "themes": ["neo-theme-neo-dark", …], so the Portal boots dark.
apps/portal/view/ViewportController.mjs#onConstructed sets viewport.theme from a stored portalTheme, or to dark when Neo.config.prefersDarkTheme is true. With neither, it sets nothing.
#onSwitchTheme: oldTheme = viewport.theme || 'neo-theme-neo-light'. On that third path viewport.theme is unset, so the method assumes light and "switches" to dark.
apps/portal/view/HeaderToolbar.mjs starts the button with iconCls: 'fa-solid fa-moon'.
- Why: #8855 made dark the default by reordering
themes in neo-config.json, a one-line change. The light fallback (from #8727) and the moon icon still assume the old light default.
The Fix
When viewport.theme is unset, fall back to the theme the app actually booted with (the first entry of themes) instead of a hardcoded light. Make sure the button's starting icon matches that theme.
Acceptance Criteria
Out of Scope
- Following the OS's light or dark preference. The dark default is deliberate.
Related
apps/portal/view/ViewportController.mjs, apps/portal/view/HeaderToolbar.mjs.
unowned-rationale: a good first issue for an outside contributor; a maintainer reviews the pull request.
Live latest-open sweep: checked the latest 20 open issues at 2026-10-20T11:12Z, plus an open-issue search for "theme switch first click": no equivalent. MC sweep: no prior decision. Own-assignment sweep: none overlapping.
Origin Session ID: ad84dc14-8baf-4f95-a7dd-a9e224f51c31
Claim it first: comment on this issue before you start, and check the open pull requests for one that already points here. We merge the first approve-worthy PR (see
CONTRIBUTING.md, point 3).Context
Welcome! This is a small fix in the Portal, the app behind neomjs.com (
apps/portal). You need a fork, Node and the dev server; no Agent OS, Docker or AI tooling.Found in release testing, 2026-10-20, with headless Chrome on a fresh profile. Headless Chrome reports
prefers-color-scheme: light, and that is the second half of the trigger. The Portal loads in its dark theme, and the header's theme button shows a moon. The first click changes the icon but keeps the dark background. Only the second click switches to light.Measured on neomjs.com, 2026-10-21, one fresh headless context per row:
portalThemeneo-theme-neo-darkneo-theme-neo-lightWho sees it: a first-time visitor whose OS or browser is set to light, on their first click only. That click stores
portalTheme, so every later visit works. Anyone who has clicked the button before, or uses dark mode, never sees it.The Problem
On that path, the first click asks for the theme that is already showing.
The Architectural Reality
apps/portal/neo-config.json:"themes": ["neo-theme-neo-dark", …], so the Portal boots dark.apps/portal/view/ViewportController.mjs#onConstructedsetsviewport.themefrom a storedportalTheme, or to dark whenNeo.config.prefersDarkThemeis true. With neither, it sets nothing.#onSwitchTheme:oldTheme = viewport.theme || 'neo-theme-neo-light'. On that third pathviewport.themeis unset, so the method assumes light and "switches" to dark.apps/portal/view/HeaderToolbar.mjsstarts the button withiconCls: 'fa-solid fa-moon'.themesinneo-config.json, a one-line change. The light fallback (from #8727) and the moon icon still assume the old light default.The Fix
When
viewport.themeis unset, fall back to the theme the app actually booted with (the first entry ofthemes) instead of a hardcoded light. Make sure the button's starting icon matches that theme.Acceptance Criteria
portalThemeand a light color-scheme preference, one click on the theme button switches dark → light, and a second click switches back.Out of Scope
Related
apps/portal/view/ViewportController.mjs,apps/portal/view/HeaderToolbar.mjs.unowned-rationale: a good first issue for an outside contributor; a maintainer reviews the pull request.
Live latest-open sweep: checked the latest 20 open issues at 2026-10-20T11:12Z, plus an open-issue search for "theme switch first click": no equivalent. MC sweep: no prior decision. Own-assignment sweep: none overlapping.
Origin Session ID: ad84dc14-8baf-4f95-a7dd-a9e224f51c31