Skip to content

Headings bold checkbox overrides native font weight from font selection #796

@jjroelofs

Description

@jjroelofs

Summary

When a Google Font with an explicit weight variant is selected for headings (e.g., Roboto 900), the headings_bold checkbox CSS (font-weight: var(--dxt-setting-headings-bold) !important) always overrides the native font weight (font-weight: var(--dxt-setting-headings-font-weight, 700)), because the bold rule uses !important and appears later in source order.

This means the precise weight from font selection (e.g., 900, 300) is never applied to headings — it's always replaced by either bold (~700) or normal (~400) from the checkbox.

Steps to reproduce

  1. Go to Appearance > DXPR Theme Settings > Typography
  2. Select a Google Font with a specific weight variant for headings (e.g., "Roboto 900")
  3. Inspect any heading element in the browser

What is the current bug behavior?

The heading gets font-weight: bold (or normal) from --dxt-setting-headings-bold, ignoring the 900 weight from the font selection.

What is the expected correct behavior?

When a native font weight is detected from font selection (e.g., 900), it should take precedence over the bold checkbox. When no explicit weight is detected (web-safe fonts, default variants), the bold checkbox should continue to work as before.

Possible fixes

Use CSS var() fallback nesting in scss/base/typography.scss:

font-weight: var(--dxt-setting-headings-font-weight, var(--dxt-setting-headings-bold)) !important;

And stop outputting --dxt-setting-headings-font-weight for fonts without an explicitly detected weight (web-safe fonts, Google fonts with "regular" variant), so the fallback to --dxt-setting-headings-bold kicks in for those cases.

Scope of affected files

  • scss/base/typography.scss
  • css/base/typography.css
  • features/sooper-settings/css-variables-theme-settings-css.inc
  • js/dist/settings-admin/font-loader.js
  • js/dist/settings-admin/field-handler.js
  • js/minified/dxpr-theme-settings-admin.bundle.min.js

Metadata

Metadata

Assignees

No one assigned

    Labels

    8.xbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions