Make WordPress Core

Opened 3 months ago

Closed 2 months ago

Last modified 4 weeks ago

#61118 closed defect (bug) (fixed)

Fluid typography: pass theme.json settings to override merged theme data

Reported by: ramonopoly's profile ramonopoly Owned by: audrasjb's profile audrasjb
Milestone: 6.6 Priority: normal
Severity: normal Version: 6.5
Component: Editor Keywords: has-patch has-unit-tests gutenberg-merge needs-dev-note
Focuses: Cc:

Description

A ticket to track the syncing of Gutenberg PR https://github.com/WordPress/gutenberg/pull/58362

The changes:

  • Update the second argument of wp_get_typography_font_size_value() to be a theme_json settings array. The argument as priority over the return value of wp_get_global_settings()
  • Add a backwards compatibility condition to handle booleans.

Why?

To generate a stylesheet, theme.json settings are often passed directly to WP_Theme_JSON.

Because typography block supports looks at the global settings only, the font sizes and CSS vars will have a clamp() value in the returned stylesheet if the current theme has fluid typography activated.

Passing theme.json settings to gutenberg_get_typography_font_size_value() as the second argument allows users of the class interface to provide their own settings, which will override any global theme settings.

See Gutenberg bug report: https://github.com/WordPress/gutenberg/issues/58135

Change History (14)

This ticket was mentioned in PR #6477 on WordPress/wordpress-develop by @ramonopoly.


3 months ago
#1

Updates the second argument of wp_get_typography_font_size_value() to be a theme_json settings array.

Add a backwards compatibility condition to handle booleans.

Syncs:

The changes:

  • Update the second argument of wp_get_typography_font_size_value() to be a theme_json settings array. The argument as priority over the return value of wp_get_global_settings()
  • Add a backwards compatibility condition to handle booleans.

#### Why?
To generate a stylesheet, theme.json settings are often passed directly to WP_Theme_JSON.

Because typography block supports looks at the global settings only, the font sizes and CSS vars will have a clamp() value in the returned stylesheet if the current theme has fluid typography activated.

Passing theme.json settings to gutenberg_get_typography_font_size_value() as the second argument allows users of the class interface to provide their own settings, which will override any global theme settings.

See Gutenberg bug report: https://github.com/WordPress/gutenberg/issues/58135

npm run test:php -- --filter Tests_Theme_wpThemeJson
npm run test:php -- --filter Tests_Block_Supports_Typography 

#2 @audrasjb
3 months ago

  • Keywords needs-dev-note added
  • Owner set to audrasjb
  • Status changed from new to reviewing
  • Version changed from trunk to 6.5

Adding needs-dev-note to mention it at least in the Misc Editor changes since this changeset replaces a bool argument with a bool|array argument of a different nature.

I also added some feedback in the PR.

#3 @isabel_brison
2 months ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 58171:

Editor: pass fluid typography theme.json settings to wp_get_typography_font_size_value.

Updates wp_get_typography_font_size_value to accept an array of theme.json settings instead of a boolean derived from global state.

Props ramonopoly, audrasjb.
Fixes #61118.

@isabel_brison commented on PR #6477:


2 months ago
#4

Committed in r58171.

This ticket was mentioned in PR #6578 on WordPress/wordpress-develop by @ramonopoly.


2 months ago
#5

https://github.com/WordPress/wordpress-develop/pull/6477 was committed but needed a rebase, as there were subsequent commits that changed the CSS root selector.

This commit updates failing tests caused after merge

#6 @peterwilsoncc
2 months ago

In 58173:

Editor: Fix unit tests for fluid typography CSS.

Fixes a unit test to assert that CSS variables are defined in :root{} rather than body{}. Fixes a couple of docblocks in the same file.

Follow up to [58171].

Props ramonopoly.
See #61118.

#9 @ramonopoly
2 months ago

#60765 was marked as a duplicate.

#10 @desrosj
6 weeks ago

In 58408:

Coding Standards: Apply changes after running composer format.

This applies several formatting related changes made while running composer format.

Follow up to [55720], [58171], [58271], [58282], [58283], [58292], [58299], [58303], [58332].
See #51857, #60719, #60895, #61021, #61118, #61228, #61276, #61324.

This ticket was mentioned in Slack in #core by juanmaguitar. View the logs.


5 weeks ago

This ticket was mentioned in Slack in #core by ramonopoly. View the logs.


4 weeks ago

This ticket was mentioned in Slack in #core by juanmaguitar. View the logs.


4 weeks ago

Note: See TracTickets for help on using tickets.