WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.51k stars 4.2k forks source link

theme.json default heading property doesn't show in h1-h6 tabs #65353

Closed mr660 closed 1 month ago

mr660 commented 1 month ago

Description

I'm developing custom FSE theme. I wanted to define default lineHeight for all my headings.

Setting up styles.elements.heading.typography.lineHeight doesn't show in admin panel in sections related to h1-h6 (it displays default wordpress value which is 1.5). It does show in "All" section.

I expect it to display default value i've set up for all headings when i didn't specify value for h1-h6 separately.

all h1-h6

theme.json:

{
  "version": 3,
  "settings": {
    "typography": {
      "defaultFontSizes": false,
      "fluid": true,
      "lineHeight": true,
      "fontSizes": [
        {
          "name": "Headline 1",
          "fluid": {
            "min": "30px",
            "max": "98px"
          },
          "size": "98px",
          "slug": "h1"
        },
        {
          "name": "Headline 2",
          "fluid": {
            "min": "26px",
            "max": "61px"
          },
          "size": "61px",
          "slug": "h2"
        },
        {
          "name": "Headline 3",
          "fluid": {
            "min": "20px",
            "max": "41px"
          },
          "size": "41px",
          "slug": "h3"
        },
        {
          "name": "Headline 4",
          "fluid": {
            "min": "18px",
            "max": "35px"
          },
          "size": "35px",
          "slug": "h4"
        },
        {
          "name": "Headline 5",
          "fluid": {
            "min": "16px",
            "max": "24px"
          },
          "size": "24px",
          "slug": "h5"
        },
        {
          "name": "Headline 6",
          "fluid": {
            "min": "14px",
            "max": "20px"
          },
          "size": "20px",
          "slug": "h6"
        },
        {
          "name": "Subtitle 1",
          "size": "16px",
          "slug": "subtitle-1"
        },
        {
          "name": "Subtitle 2",
          "size": "14px",
          "slug": "subtitle-2"
        }
      ]
    }
  },
  "styles": {
    "elements": {
      "heading": {
        "typography": {
          "lineHeight": "1.1"
        }
      },
      "h1": {
        "typography": {
          "fontSize": "var:preset|font-size|h-1"
        }
      },
      "h2": {
        "typography": {
          "fontSize": "var:preset|font-size|h-2"
        }
      },
      "h3": {
        "typography": {
          "fontSize": "var:preset|font-size|h-3"
        }
      },
      "h4": {
        "typography": {
          "fontSize": "var:preset|font-size|h-4"
        }
      },
      "h5": {
        "typography": {
          "fontSize": "var:preset|font-size|h-5"
        }
      },
      "h6": {
        "typography": {
          "fontSize": "var:preset|font-size|h-6"
        }
      }
    }
  }
}

Step-by-step reproduction instructions

  1. Set up theme.json like in example
  2. Go to Appearance->Editor
  3. Go to Styles
  4. Open Styles side panel
  5. Go to Typography->Headings
  6. "All" Headings shows line-height set to 1.1
  7. H1 to H6 displays 1.5

Screenshots, screen recording, code snippet

No response

Environment info

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

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

carolinan commented 1 month ago

Hi! This issue is already discussed in https://github.com/WordPress/gutenberg/issues/64670, please continue the conversation there. I am closing this as a duplicate.