Skip to content

Global styles: Default font sizes are added #52200

@hanneslsm

Description

@hanneslsm

Description

I created a blank theme and added custom font sizes.
This works intended in the editor, but in the Global styles, default font sizes are added in the drop down (S, M, L, XL)

Step-by-step reproduction instructions

  1. Copy the nearly blank theme.js from below
  2. Go into Global Style → Typography → Text
  3. See in the drop down the additional "Small, Medium, Large, Extra Large" font sizes, that shouldn't be there.
theme.js

{
  "settings": {
    "appearanceTools": true,
    "color": {
      "background": true,
      "custom": true,
      "customDuotone": true,
      "customGradient": true,
      "defaultDuotone": false,
      "defaultGradients": false,
      "defaultPalette": false,
      "duotone": [],
      "gradients": [],
      "palette": [],
      "text": true
    },
    "layout": {
      "contentSize": "620px",
      "wideSize": "1000px"
    },
    "shadow": {
      "defaultPresets": true,
      "presets": []
    },
    "spacing": {
      "customSpacingSize": true,
      "spacingScale": {
        "increment": 1.5,
        "mediumStep": 1.5,
        "operator": "*",
        "steps": 7,
        "unit": "rem"
      },
      "spacingSizes": [],
      "units": ["%", "px", "em", "rem", "vh", "vw"]
    },
    "typography": {
      "customFontSize": true,
      "dropCap": true,
      "fluid": true,
      "fontFamilies": [
        {
          "fontFamily": "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif",
          "name": "System Font",
          "slug": "system-font"
        },
        {
          "fontFace": [
            {
              "fontFamily": "Barlow",
              "fontStyle": "italic",
              "fontWeight": "700",
              "src": ["file:./assets/fonts/barlow_italic_700.ttf"]
            },
            {
              "fontFamily": "Barlow",
              "fontStyle": "normal",
              "fontWeight": "700",
              "src": ["file:./assets/fonts/barlow_normal_700.ttf"]
            },
            {
              "fontFamily": "Barlow",
              "fontStyle": "italic",
              "fontWeight": "600",
              "src": ["file:./assets/fonts/barlow_italic_600.ttf"]
            },
            {
              "fontFamily": "Barlow",
              "fontStyle": "normal",
              "fontWeight": "600",
              "src": ["file:./assets/fonts/barlow_normal_600.ttf"]
            },
            {
              "fontFamily": "Barlow",
              "fontStyle": "italic",
              "fontWeight": "400",
              "src": ["file:./assets/fonts/barlow_italic_400.ttf"]
            },
            {
              "fontFamily": "Barlow",
              "fontStyle": "normal",
              "fontWeight": "400",
              "src": ["file:./assets/fonts/barlow_normal_400.ttf"]
            }
          ],
          "fontFamily": "Barlow",
          "slug": "barlow"
        }
      ],
      "fontSizes": [
        {
          "name": "Display xl",
          "slug": "Display-xl",
          "size": "96px",
          "fluid": {
            "max": "96px",
            "min": "52px"
          }
        },
        {
          "name": "Display lg",
          "slug": "Display-lg",
          "size": "72px",
          "fluid": {
            "max": "72px",
            "min": "46px"
          }
        },
        {
          "name": "Display md",
          "slug": "Display-md",
          "size": "60px",
          "fluid": {
            "max": "60px",
            "min": "42px"
          }
        },
        {
          "name": "Display sm",
          "slug": "Display-sm",
          "size": "52px",
          "fluid": {
            "max": "52px",
            "min": "40px"
          }
        },
        {
          "name": "Heading 1",
          "slug": "Heading-1",
          "size": "48px",
          "fluid": {
            "max": "48px",
            "min": "36px"
          }
        },
        {
          "name": "Heading 2",
          "slug": "Heading-2",
          "size": "36px",
          "fluid": {
            "max": "36px",
            "min": "30px"
          }
        },
        {
          "name": "Heading 3",
          "slug": "Heading-3",
          "size": "28px",
          "fluid": {
            "max": "28px",
            "min": "26px"
          }
        },
        {
          "name": "Heading 4",
          "slug": "Heading-4",
          "size": "24px",
          "fluid": {
            "max": "24px",
            "min": "22px"
          }
        },
        {
          "name": "Heading 5",
          "slug": "Heading-5",
          "size": "20px",
          "fluid": {
            "max": "20px",
            "min": "19px"
          }
        },
        {
          "name": "Heading 6",
          "slug": "Heading-6",
          "size": "18px",
          "fluid": {
            "max": "18px",
            "min": "17px"
          }
        },
        {
          "name": "Paragraph lg",
          "slug": "paragraph-lg",
          "size": "18px",
          "fluid": {
            "max": "18px",
            "min": "17px"
          }
        },
        {
          "name": "Paragraph base",
          "slug": "paragraph-base",
          "size": "16px",
          "fluid": {
            "max": "16px",
            "min": "16px"
          }
        },
        {
          "name": "Paragraph sm",
          "slug": "paragraph-sm",
          "size": "14px",
          "fluid": {
            "max": "14px",
            "min": "14px"
          }
        },
        {
          "name": "Info md",
          "slug": "Info-md",
          "size": "12px",
          "fluid": {
            "max": "12px",
            "min": "12px"
          }
        },
        {
          "name": "Info sm",
          "slug": "Info-sm",
          "size": "10px",
          "fluid": {
            "max": "10px",
            "min": "10px"
          }
        }
      ],
      "fontStyle": true,
      "fontWeight": true,
      "letterSpacing": true,
      "textDecoration": true,
      "textTransform": true
    },
    "useRootPaddingAwareAlignments": true
  },
  "styles": {
    "spacing": {
      "padding": {
        "bottom": "0px",
        "left": "16px",
        "right": "16px",
        "top": "0px"
      }
    }
  },
  "templateParts": [
    {
      "area": "header",
      "name": "header"
    },
    {
      "area": "footer",
      "name": "footer"
    }
  ],
  "version": 2,
  "$schema": "https://schemas.wp.org/trunk/theme.json"
}

Screenshots, screen recording, code snippet

Block styles (as it should be) Global styles (with additonal font sizes)
image image

Environment info

  • WP 6.2.2
  • GB 16.1.0

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

Metadata

Metadata

Assignees

Labels

Global StylesAnything related to the broader Global Styles efforts, including Styles Engine and theme.json[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions