Skip to content

fix: desktop follow-system theme tracks the OS inside tab iframes - #157

Closed
mvanhorn wants to merge 1 commit into
Edwardxlai:mainfrom
mvanhorn:fix/148-desktop-follow-system-theme
Closed

mvanhorn wants to merge 1 commit into
Edwardxlai:mainfrom
mvanhorn:fix/148-desktop-follow-system-theme

Conversation

@mvanhorn

@mvanhorn mvanhorn commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Why

In the desktop app, Follow system does not keep the interface in step with the operating system's light or dark appearance. The library can stay light while the system is dark, it stays put when the system switches, and reopening the app can still leave it light; after a manual dark theme, returning to Follow system can leave the app dark as the system changes.

Each paper tab is an iframe whose color-scheme was only the shell's current one: light from the default page style, or dark after a manual dark theme. Chromium then reports prefers-color-scheme inside that frame as that single scheme, so Follow system reads the shell's theme rather than the OS, and the shell copies that reading back onto itself. The library applied the saved theme only at load and never subscribed to later prefers-color-scheme changes.

Summary of the fix

The paper-pane style now sets color-scheme to light dark, so each tab iframe's prefers-color-scheme follows the OS. The library adds a change listener on that media query and reapplies the theme saved in preferences. The library page test double can report a color scheme and dispatch change events, and a new test checks that the pane rule includes color-scheme: light dark, that the base stylesheet does not, and that a scheme change reapplies auto, light, dark, and a missing theme.

Verification

  • The tests in tests/helpers/library_page.cjs and tests/web/test_library_theme.cjs fail without the fix in the easyread change (checked by reverting the source changes).
  • The changed test tests/helpers/library_page.cjs did not run here: no test runner for it was available.
  • The new test tests/web/test_library_theme.cjs did not run here: no test runner for it was available.

Closes #148

The paper-pane style now sets color-scheme to light dark, so each tab
iframe's prefers-color-scheme follows the OS. The library adds a change
listener on that media query and reapplies the theme saved in
preferences. The library page test double can report a color scheme and
dispatch change events, and a new test checks that the pane rule
includes color-scheme: light dark, that the base stylesheet does not,
and that a scheme change reapplies auto, light, dark, and a missing
theme.

Fixes Edwardxlai#148
@Edwardxlai

Copy link
Copy Markdown
Owner

@mvanhorn Thanks for tracing this to the tab iframe. Both focused tests passed locally. The next check is on our side: toggle the Windows theme with the library and a paper open, then restart and confirm both tabs follow the OS.

@Edwardxlai

Copy link
Copy Markdown
Owner

I’m planning to ship this fix in v1.5. I’ve included your patch in the local v1.5 preview and will run the remaining Windows desktop check before release. Thanks for the fix!

@Edwardxlai Edwardxlai closed this Nov 14, 2026
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.

[Bug] 在设置里修改「界面主题」,保存后又被改回原来的值(重启后选项还原)

2 participants