Skip to content

fix: resolve flash of unstyled content in dark mode#766

Open
TusharThakur04 wants to merge 1 commit intonodejs:mainfrom
TusharThakur04:fix/dark-mode-FOUC
Open

fix: resolve flash of unstyled content in dark mode#766
TusharThakur04 wants to merge 1 commit intonodejs:mainfrom
TusharThakur04:fix/dark-mode-FOUC

Conversation

@TusharThakur04
Copy link
Copy Markdown

Description

This PR resolves the FOUC by resolving system to dark or light using matchMedia.
Earlier system was directly being applied as set-theme = system

Validation

before :

Screencast.from.2026-04-13.19-26-34.webm

after :

Screencast.from.2026-04-13.19-24-03.webm

Related Issues

n/a

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run node --run test and all tests passed.
  • I have check code formatting with node --run format & node --run lint.
  • I've covered new added functionality with unit tests if necessary.

@TusharThakur04 TusharThakur04 requested a review from a team as a code owner April 13, 2026 14:23
@cursor
Copy link
Copy Markdown

cursor bot commented Apr 13, 2026

PR Summary

Low Risk
Low risk: a small inline script change in the HTML template that only affects initial theme selection and color-scheme styling before hydration.

Overview
Fixes initial theme bootstrapping in template.html to resolve a stored theme=system preference into the actual OS dark/light value via matchMedia before setting data-theme and colorScheme.

This prevents the page from briefly rendering with an invalid system theme value and reduces dark-mode FOUC on load.

Reviewed by Cursor Bugbot for commit 4ae89b4. Bugbot is set up for automated code reviews on this repo. Configure here.

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
api-docs-tooling Ready Ready Preview Apr 13, 2026 2:30pm

Request Review

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 893ddea. Configure here.

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