fix: Safari theme switching on docs page#74
Merged
maskedsyntax merged 1 commit intomainfrom Mar 16, 2026
Merged
Conversation
Remove background-color from body's CSS transition — Safari's transition engine fights inline style updates when the underlying CSS variable changes simultaneously. Body background is now set directly via JS in the theme apply function. Syntax highlight colors moved to CSS custom properties for reliable Safari inheritance.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Safari's CSS transition engine on
background-colorfights inline style updates when the underlying CSS variable (var(--bg-primary)) changes simultaneously via a[data-theme]attribute swap on<html>. The transition animation overrides even!importantinline styles, leaving the body background stuck on the previous theme's color.This removes
background-colorfrom the body's CSS transition and sets it directly via JS in the themeapply()function using hardcoded values matching--bg-primary. Syntax highlight colors are also moved from[data-theme="dark"]selector overrides to CSS custom properties so they update via variable inheritance (reliable in Safari) rather than selector re-evaluation (deferred by WebKit in complex layouts).