Skip to content

fix: Safari theme switching on docs page#74

Merged
maskedsyntax merged 1 commit intomainfrom
fix/safari-theme-switching
Mar 16, 2026
Merged

fix: Safari theme switching on docs page#74
maskedsyntax merged 1 commit intomainfrom
fix/safari-theme-switching

Conversation

@maskedsyntax
Copy link
Member

Summary

Safari's CSS transition engine on background-color fights 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 !important inline styles, leaving the body background stuck on the previous theme's color.

This removes background-color from the body's CSS transition and sets it directly via JS in the theme apply() 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).

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.
@vercel
Copy link

vercel bot commented Mar 16, 2026

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

Project Deployment Actions Updated (UTC)
hashprep Ready Ready Preview, Comment Mar 16, 2026 4:05pm

@maskedsyntax maskedsyntax merged commit cb8c8a2 into main Mar 16, 2026
6 checks passed
@maskedsyntax maskedsyntax deleted the fix/safari-theme-switching branch March 16, 2026 16:11
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