fix(theme): 'Same as body' heading font no longer inherits stale value

This commit is contained in:
Luca
2026-05-11 11:50:09 +02:00
parent 7ac1d14738
commit 35f5b86d0f
+12 -3
View File
@@ -186,9 +186,18 @@ export const ThemeProvider: React.FC<ThemeProviderProps> = ({
void loadFontForFamily(themeConfig.fontFamily); void loadFontForFamily(themeConfig.fontFamily);
} }
if (themeConfig.headingFontFamily) { // "Same as body" is stored as headingFontFamily='' — in that case
root.style.setProperty('--heading-font-family', themeConfig.headingFontFamily); // mirror the body family so a stale --heading-font-family (e.g.
void loadFontForFamily(themeConfig.headingFontFamily); // from a previously-visited gallery with a serif heading theme)
// doesn't bleed into pages that picked the matched-fonts option.
// Without this fall-through the CSS variable retained the last
// explicit value across theme switches, which is why the customer
// profile and admin login rendered serif headings even though the
// active theme had "Same as body" selected.
const effectiveHeadingFont = themeConfig.headingFontFamily || themeConfig.fontFamily;
if (effectiveHeadingFont) {
root.style.setProperty('--heading-font-family', effectiveHeadingFont);
void loadFontForFamily(effectiveHeadingFont);
} }
if (themeConfig.borderRadius) { if (themeConfig.borderRadius) {