fix: use data-font attribute instead of inline style for font toggle (#1552)

* fix: use data-font attribute instead of inline style for font toggle

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* fix: use inline style for font-body-base to win cascade over variant themes

Copilot review flagged that [data-font="system"] in @layer base loses to
unlayered variant themes (e.g. happy-theme sets --font-body: Nunito).
Switch back to inline style on --font-body-base so user font preference
always wins the cascade, while keeping the RTL/CJK composition via
var(--font-body-base) fallback.

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Elie Habib <elie.habib@gmail.com>
This commit is contained in:
Abdul Taufeeq M
2026-03-15 19:09:56 +05:30
committed by GitHub
parent 81b1fd89b9
commit 327e3aa869
2 changed files with 8 additions and 5 deletions

View File

@@ -55,16 +55,19 @@
/* Font stack */
--font-mono: 'SF Mono', 'Monaco', 'Cascadia Code', 'Fira Code', 'DejaVu Sans Mono', 'Liberation Mono', monospace;
--font-body: var(--font-mono);
/* Base body font, controlled by font preference (mono vs system) */
--font-body-base: var(--font-mono);
/* Effective body font used throughout the app */
--font-body: var(--font-body-base);
}
[dir="rtl"] {
--font-body: 'Tajawal', 'Geeza Pro', 'SF Arabic', 'Tahoma', system-ui, sans-serif;
--font-body: 'Tajawal', 'Geeza Pro', 'SF Arabic', 'Tahoma', var(--font-body-base);
}
:lang(zh-CN),
:lang(zh) {
--font-body: 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', system-ui, sans-serif;
--font-body: 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', var(--font-body-base);
}
/* ============================================================