Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#54460 closed defect (bug) (fixed)

Ensure links to the Customizer send users to an appropriate destination in 5.9

Reported by: jameskoster's profile jameskoster Owned by: hellofromtonya's profile hellofromTonya
Milestone: 5.9 Priority: normal
Severity: normal Version:
Component: General Keywords: has-patch commit has-unit-tests has-testing-info
Focuses: ui, administration Cc:

Description

In 5.9, when a block theme is active, access to the Customizer is hidden by default. There are however a few remaining links to the Customizer throughout the wp-admin interface. In particular on the Themes page, and on the Dashboard.

It might be better to make the destination of these links conditional. IE if a classic theme is active, link to the Customizer (no change). If a block theme is active link to Appearance > Editor.

Attachments (3)

142033022-ed9dd2be-4a30-44ae-a7fa-c04099b65ac1.png (129.2 KB) - added by jameskoster 3 years ago.
114105726-876e6580-988a-11eb-9450-af8f15705c08.png (351.6 KB) - added by jameskoster 3 years ago.
Screenshot 2021-11-22 at 11.27.10.png (35.1 KB) - added by jameskoster 3 years ago.
Customize link in the Theme Editor

Download all attachments as: .zip

Change History (31)

#1 @SergeyBiryukov
3 years ago

  • Component changed from General to Customize
  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 5.9

Hi there, welcome back to WordPress Trac!

Thanks for the report, moving to the milestone for visibility.

#2 @SergeyBiryukov
3 years ago

  • Focuses ui administration added

#3 @poena
3 years ago

Before this can be done, the solutions for the site icon and starter content needs to be completed:

Last edited 3 years ago by SergeyBiryukov (previous) (diff)

#4 @matveb
3 years ago

Regarding the "welcome to WordPress" box, it goes beyond just updating the links. This is a missed opportunity to establish the main concepts (blocks, patterns, styles), set the right expectations (early access?), and guide users better.

#5 @noisysocks
3 years ago

Closed https://github.com/WordPress/gutenberg/issues/36578 in favour of this ticket. See there for some more commentary.

#6 @noisysocks
3 years ago

  • Component changed from Customize to General
  • Keywords needs-design added

#7 @poena
3 years ago

Regarding the "welcome to WordPress" box, it goes beyond just updating the links. This is a missed opportunity to establish the main concepts (blocks, patterns, styles), set the right expectations (early access?), and guide users better.

I love that idea.
Does it needs it's own issue though?

This ticket was mentioned in Slack in #core-editor by noisysocks. View the logs.


3 years ago

@jameskoster
3 years ago

Customize link in the Theme Editor

#9 @desrosj
3 years ago

Related: #54489.

#10 @antonvlasenko
3 years ago

I'm working on this issue.

This ticket was mentioned in Slack in #core-editor by noisysocks. View the logs.


3 years ago

This ticket was mentioned in PR #1933 on WordPress/wordpress-develop by anton-vlasenko.


3 years ago
#12

  • Keywords has-patch added; needs-patch removed

In 5.9, when a block theme is active, access to the Customizer is hidden by default. There are however a few remaining links to the Customizer throughout the wp-admin interface. In particular on the Themes page, and on the Dashboard.

This PRs aims to change these links depending on the current theme. If the current theme is block-based, we send users to the Appearance -> Editor page instead.

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

#13 @noisysocks
3 years ago

  • Owner set to antonvlasenko
  • Status changed from new to assigned

anton-vlasenko commented on PR #1933:


3 years ago
#14

I've added 2 new test block themes. I tried to modify the old ones and this caused unit tests to fail. They are not intended to be the block themes (despite their names).

#15 @noisysocks
3 years ago

  • Keywords commit added; needs-design removed

Thanks @antonvlasenko. Let's get this in for beta 1 and make any necessary tweaks as follow-up commits.

This ticket was mentioned in Slack in #core-themes by poena. View the logs.


3 years ago

palmsout commented on PR #1933:


3 years ago
#17

Sorry if I'm missing the point here, but aren't there still important applications of the customizer for block themes? The obviously one being that it allows users to add additional css without having to edit theme code? I don't know where I'd be without that ability, and I use a block theme.

palmsout commented on PR #1933:


3 years ago
#18

Sorry if I'm missing the point here, but aren't there still important applications of the customizer for block themes? The obvious one being that it allows users to add additional css without having to edit theme code? I don't know where I'd be without that ability, and I use a block theme.

#19 @hellofromTonya
3 years ago

  • Keywords has-unit-tests added
  • Owner changed from antonvlasenko to hellofromTonya
  • Status changed from assigned to reviewing

Self-assigning for testing, review, and, if all is good, commit.

hellofromtonya commented on PR #1933:


3 years ago
#20

@anton-vlasenko I refactored the tests to use data providers and named datasets as well as added additional test data for when a theme or file does not exist. Tests pass https://github.com/WordPress/wordpress-develop/pull/1933/commits/641751b5915da26eb3f014ad8f776442ba726cde.

The failed CI jobs are not related to this PR, but rather are due to changeset https://core.trac.wordpress.org/changeset/52272.

#21 @hellofromTonya
3 years ago

  • Keywords has-testing-info added

Test Report

Env:

  • Browsers: Firefox, Chrome, Edge, and Safari
  • WordPress: trunk with PR 1933 applied
  • OS: macOS Big Sur
  • localhost: wp-env

Steps

After applying the patch, do the following:

  1. Activate Twenty Twenty-One theme.
  2. Check the link in the "Customize" button links to /wp-admin/customize.php?theme=twentytwentyone&return=/wp-admin/themes.php.
  3. Go to Dashboard > Home
  4. Check that the "Customize Your Site" button links to /wp-admin/customize.php and the "change your theme completely" links to /wp-admin/customize.php?autofocus[panel]=themes.
  5. Go back to Appearance > Themes.
  6. Activate Twenty Twenty-Two theme.
  7. Check the link in the "Customize" button links to /wp-admin/site-editor.php.
  8. Go to Dashboard > Home.
  9. Check that the "Customize Your Site" button links to /wp-admin/site-editor.php and the "change your theme completely" links to /wp-admin/themes.php.
  10. Go back to Appearance > Themes.
  11. Activate Twenty Nineteen.
  12. Click on the Customize button to open Customizer.
  13. Click on "Change" in the "Active theme" area.
  14. Notice Twenty Twenty-Two is displayed there. Click on "Live Preview" button.
  15. Then click "Activate & Publish" button.

Test Results

  1. Testing Twenty Twenty-One:
    • Customize button rendered as expected ✅
    • Welcome Dashboard: both the button and link rendered as expected ✅
  2. Testing Twenty Twenty-Two:
    • Customize button rendered as expected ✅
    • Welcome Dashboard: both the button and link rendered as expected ✅
  3. Switching to Twenty Twenty-Two within Customizer: yes, switching works ✅

PR 1933 works as expected.

#22 @hellofromTonya
3 years ago

@antonvlasenko @noisysocks Right now, it's possible to switch to a block theme from within Customizer.

How to switch to it?

  1. Activate a non-block theme like Twenty Nineteen.
  2. Click on Customize button to open Customizer.
  3. Click on "Change" in the "Active theme" area.
  4. Notice Twenty Twenty-Two is displayed there. Click on "Live Preview" button.
  5. Click "Activate & Publish" button.

Do you foresee any issues?

#23 @antonvlasenko
3 years ago

@hellofromTonya
Thank you for the code review!

Do you foresee any issues?

I think that's a minor bug. As far as I understand, we strive to hide Customizer for non-block based themes.
I will try to fix it ASAP (in the scope of the existing PR).

Last edited 3 years ago by antonvlasenko (previous) (diff)

#24 @hellofromTonya
3 years ago

After talking with @antonvlasenko, the issue of activating a block theme within the Customizer needs thought and lots of testing. It's outside the scope of this ticket. Anton will open a new issue for it.

PR 1933 is approved and ready for commit. I'll prep the commit.

#25 @hellofromTonya
3 years ago

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

In 52279:

Administration: For block themes, link to Site Editor interface instead of Customizer in Dashboard's welcome panel and Themes interface.

For block themes (like Twenty Twenty-Two), Customizer menu item is removed and replaced with the Site Editor menu item. However, other links exist in the Dashboard's welcome panel "Customize Your Site" button and the "Customize" button in each theme listed in the Appearance > Themes interface.

This commit changes each of those remaining links to link to the Site Editor interface instead of the Customizer.

To help identify block vs non-block themes, two method methods are introduced in WP_Theme:

  • WP_Theme:: is_block_based() which identifies if the theme is a block theme or not.
  • WP_Theme::get_file_path() which is similar to get_theme_file_path() but uses the directories within the theme object.

Both of these new methods include test coverage including the addition of a parent and child block theme in test data.

Follow-up to [18749], [35483], [42013], [42169].

Props antonvlasenko, jameskoster, hellofromTonya, matveb, noisysocks, poena, sergeybiryukov.
Fixes #54460.

anton-vlasenko commented on PR #1933:


3 years ago
#27

Thank you, @hellofromtonya!

#28 @antonvlasenko
3 years ago

 it's possible to switch to a block theme from within Customizer.

I've created a new ticket to track this bug.
Props to @hellofromTonya.

Note: See TracTickets for help on using tickets.