Make WordPress Core

Opened 2 years ago

Closed 23 months ago

Last modified 22 months ago

#57460 closed enhancement (fixed)

Allow non-block themes to add theme support for `appearance-tools`

Reported by: ironprogrammer's profile ironprogrammer Owned by: audrasjb's profile audrasjb
Milestone: 6.2 Priority: normal
Severity: normal Version:
Component: Themes Keywords: has-screenshots gutenberg-merge
Focuses: Cc:

Description (last modified by ironprogrammer)

Allow themes without theme.json to opt-in to appearance tools via:

add_theme_support( 'appearance-tools' );

Originally planned for 6.1, this backport missed the original cutoff. Backports changes from https://github.com/WordPress/gutenberg/pull/43337.

Related: #56467

Attachments (6)

Capture d’écran 2023-01-14 à 10.21.13.png (162.5 KB) - added by audrasjb 2 years ago.
Before patch: group block
Capture d’écran 2023-01-14 à 10.21.03.png (166.9 KB) - added by audrasjb 2 years ago.
Before patch: paragraph block
Capture d’écran 2023-01-14 à 10.21.33.png (178.4 KB) - added by audrasjb 2 years ago.
Before patch: button block
Capture d’écran 2023-01-14 à 10.22.14.png (171.2 KB) - added by audrasjb 2 years ago.
After patch: group block ✅
Capture d’écran 2023-01-14 à 10.21.59.png (173.3 KB) - added by audrasjb 2 years ago.
After patch: paragraph block ✅
Capture d’écran 2023-01-14 à 10.22.29.png (180.5 KB) - added by audrasjb 2 years ago.
After patch: button block ✅

Download all attachments as: .zip

Change History (27)

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


2 years ago
#1

  • Keywords has-patch has-unit-tests added

Adds unit test to #3337. See original PR for additional details.

Backport of https://github.com/WordPress/gutenberg/pull/43337.

Props ockham, hellofromtonya, dream-encode, carolinan.

Trac ticket: https://core.trac.wordpress.org/ticket/57460

#2 @ironprogrammer
2 years ago

  • Keywords has-testing-info needs-testing added

Testing Instructions

Setup

  • Disable the Gutenberg plugin, if active.
  • Install and activate a theme that does not use theme.json (e.g. a "classic" theme").

Steps to Test

  1. In the theme's functions.php file, add the following theme support (often located in an after_setup_theme hook):
    add_theme_support( 'appearance-tools' );
    
  2. Create a new post with a Group block. Inside the group, add a Paragraph with a link, and add a Buttons block with a few buttons.
  3. Make sure the Settings sidebar is visible (gear icon, upper right of editor).
  4. Select the Group, Buttons, and Paragraph blocks to verify the new appearance tools style options available in the sidebar.

Expected Results

  • Color > Link allows the selection of hyperlink color in the Group and Paragraph blocks (not in Buttons).
  • Dimensions > Block Spacing allows spacing between elements to be changed. The Buttons block is an easy way to verify this.
  • ✅ The Border section is displayed for the Group block, and allows changing the border color, style, width, and radius.

Test Report Icons:
✅ <= Behavior is expected.
❌ <= Behavior is NOT expected.

#3 @ironprogrammer
2 years ago

Test Report

Patch tested: https://github.com/WordPress/wordpress-develop/pull/3846

Environment

  • Hardware: MacBook Pro Apple M1 Pro
  • OS: macOS 12.6.2
  • Browser: Safari 16.2
  • Server: nginx/1.23.3
  • PHP: 7.4.33
  • WordPress: 6.2-alpha-54642-src
  • Theme: blank-canvas v1.2.9
  • Gutenberg DISABLED 🔴

Actual Results

  • ✅ New styles options are available in the editor's Settings sidebar.
  • ✅ When applied, the styles are visible in the editor and frontend post.

Supplemental Artifacts

Example "After" post has border, button spacing, and link color adjustments applied.

Post in Blank Canvas Theme Post After Adding appearance-tools Support
https://cldup.com/eqtaO4Vic2.png https://cldup.com/vwOo3B42bu.png

#4 @ironprogrammer
2 years ago

  • Description modified (diff)

#5 @audrasjb
2 years ago

  • Keywords needs-dev-note add-to-field-guide added

@audrasjb
2 years ago

Before patch: group block

@audrasjb
2 years ago

Before patch: paragraph block

@audrasjb
2 years ago

Before patch: button block

@audrasjb
2 years ago

After patch: group block ✅

@audrasjb
2 years ago

After patch: paragraph block ✅

@audrasjb
2 years ago

After patch: button block ✅

#6 @audrasjb
2 years ago

  • Keywords has-screenshots added; needs-testing removed
  • Owner set to audrasjb
  • Status changed from new to accepted

Patch works fine!

Self assigning for commit.

#7 @audrasjb
2 years ago

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

In 55067:

Themes: Add opt-in Appearance Tools support for Classic Themes.

This changeset merges the following changes from Gutenberg repository:

  • Allow themes without theme.json to opt-in to appearance tools via add_theme_support( 'appearance-tools' );
  • Update wpThemeJsonResolver unit tests accordingly

See the following pull request for more info: https://github.com/WordPress/gutenberg/pull/43337

Props ironprogrammer, audrasjb.
Fixes #57460.

#9 @audrasjb
2 years ago

Oops, missed some props.
Adding bernhard-reiter, hellofromtonya, davidbaumwald, and poena manually.

#10 follow-up: @poena
23 months ago

I've found a bug with the block gap (in the Dimensions panel this is called block spacing),
and opened issue 47386 in the Gutenberg GitHub repository.

I think we can give it a few days to try to find a CSS solution, if not, we can perhaps revert this and add support for all appearance tools except block gap?

#11 @audrasjb
23 months ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Thanks @poena, yes sounds like a good plan 👌

#12 @audrasjb
23 months ago

  • Keywords has-patch has-unit-tests has-testing-info removed

#13 @hellofromTonya
23 months ago

  • Keywords gutenberg-merge added

Adding experimental keyword for tracking backports/syncs from Gutenberg into Core.

#14 @andrewserong
23 months ago

I think we can give it a few days to try to find a CSS solution, if not, we can perhaps revert this and add support for all appearance tools except block gap?

Thanks for following up here @poena — for Classic themes, I think it'd be safer for the appearance tools opt-in to not include block gap, as it was written with block themes in mind, and it sounds like it could add a fair bit of complexity to attempt to get the layout block gap rules playing nicely with Classic themes.

#15 @poena
23 months ago

I suggest the following:

Re add the link color theme support, which was the feature that was removed without replacement in 5.9.

Add a new border theme support.

So these two would be separate.

Last edited 23 months ago by poena (previous) (diff)

#16 in reply to: ↑ 10 @azaozz
23 months ago

  • Keywords close added

Replying to poena:

I've found a bug with...

As this is an enhancement that was already added to core trunk, and "feature freeze" is tomorrow, could you open a new trac ticket for this bug, and mention the Gutenberg PR in it. Then the bugfix (when ready) can be committed from that ticket.

This should be closed as fixed imho.

#17 @poena
23 months ago

I have asked the release leads for guidance since the bug fix is the revert.

#19 @costdev
23 months ago

  • Keywords close removed
  • Resolution set to fixed
  • Status changed from reopened to closed

As the ticket has been created for the bug, I'll close this ticket as fixed per comment:16

#20 @audrasjb
22 months ago

  • Keywords needs-dev-note add-to-field-guide removed

Removing needs-dev-note keyword as this was reverted in [55273].

#21 @desrosj
22 months ago

  • Summary changed from Backport: appearance-tools theme_support to Allow non-block themes to add theme support for `appearance-tools`
Note: See TracTickets for help on using tickets.