Skip to content

fix(docs): preserve body classes in dark mode - #1933

Open
ZLlele wants to merge 1 commit into
animate-css:mainfrom
ZLlele:fix/issue-1930-dark-mode-body-class
Open

ZLlele wants to merge 1 commit into
animate-css:mainfrom
ZLlele:fix/issue-1930-dark-mode-body-class

Conversation

@ZLlele

@ZLlele ZLlele commented Oct 27, 2026

Copy link
Copy Markdown

Fixes #1930

Summary

Use document.body.classList.add('dark') when restoring dark mode from localStorage.

The previous implementation assigned document.body.className = 'dark', which removed any existing classes on the <body> element, such as layout or accessibility classes.

Changes

  • Preserve existing <body> classes when dark mode is initialized.
  • Keep the existing dark mode toggle behavior unchanged.

Validation

  • Verified that existing body classes are preserved when dark mode is restored.
  • Verified that the dark class is added correctly.
  • Verified that disabling dark mode removes only the dark class.
  • Ran git diff --check.

Copilot AI balanced review requested due to automatic review settings October 27, 2026 07:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

This branch has not been deployed

No deployments
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.

fix(docs): darkModeControl overwrites document.body.className instead of using classList.add

2 participants