Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customizer: Error in console after opening a widget area when a theme opts-out of the new block-based “Widgets” screen #24949

Closed
pagelab opened this issue Aug 31, 2020 · 9 comments
Labels
[Feature] Widgets Screen The block-based screen that replaced widgets.php. [Type] Bug An existing feature does not function as intended

Comments

@pagelab
Copy link
Contributor

pagelab commented Aug 31, 2020

Describe the bug
Since Gutenberg 8.9.0 RC1 (#24087) it is possible to opt-out of the new block-based “Widgets” screen adding remove_theme_support( 'widgets-block-editor' ); to any theme.

This keeps the legacy “Widgets” screen and prevent the new block-based “Widgets” screen to appear.

But doing so does not bring back the legacy “Widgets” section on the customizer.

It's crucial to maintain this section for backward compatibility reasons, specially for themes that heavily use widgets for layout purposes or widgets that have many visual controls, like color pickers.

To reproduce
Steps to reproduce the behavior:

  1. Using any theme, add remove_theme_support( 'widgets-block-editor' ); in the functions.php file to opt-out of the new block-based “Widgets” screen.
  2. Install and activate the Gutenberg 8.9.0 RC1 plugin in “Plugins → Add new”.
  3. Click “Appearance → Customize”.
  4. See that the legacy “Widgets” section is missing.

Expected behavior
When a theme opts-out of the new block-based “Widgets” screen, the legacy “Widgets” section should appear on the customizer.

Screenshots
missing-widgets-section-customizer

Editor version:

  • WordPress version: 5.5.0
  • Gutenberg 8.9.0 RC1
  • TwentyTwenty 1.5

Desktop:

  • macOS 10.14.6
  • Chrome 85
@adamziel
Copy link
Contributor

This is temporarily fixed by merging #25626, although the discussion about the fate of the customizer editor is still ongoing: #25625. I'm marking it as blocked for now.

@rebeccahum rebeccahum added the [Status] Blocked Used to indicate that a current effort isn't able to move forward label Sep 28, 2020
@bph
Copy link
Contributor

bph commented Oct 15, 2020

I tested this with master today. (Oct 15, 2020)
The Widget section appears in the Customizer and I could add and delete widgets without any problems.

@pagelab
Copy link
Contributor Author

pagelab commented Oct 28, 2020

I did a test with Gutenberg version 9.2.2 and it's working now.

@draganescu
Copy link
Contributor

I am reopening this as trying to test with the Gutenberg plugin activated, adding remove_theme_support( 'widgets-block-editor' ); will result in Uncaught Error: Call to undefined method stdClass::_register() in wp-includes/class-wp-widget-factory.php:102.

@draganescu draganescu reopened this Mar 23, 2021
@noisysocks noisysocks removed the [Status] Blocked Used to indicate that a current effort isn't able to move forward label Apr 8, 2021
@noisysocks
Copy link
Member

@draganescu: Where are you seeing that error? When I enable the Gutenberg plugin, enable the Widgets screen in Customizer experiment, add remove_theme_support( 'widgets-block-editor' ); to gutenberg.php, and browse to Appearance → Customize → Widgets I see the old interface and no error.

@draganescu
Copy link
Contributor

That was a while ago @noisysocks
Tested again, now there is no more PHP error, however, with the block widgets disabled from the theme functions file, I get the widgets panel back but currently on trunk opening that section or adding an image widget results in Uncaught TypeError: t.onChangeSectionExpanded is not a function

@tellthemachines
Copy link
Contributor

I can partially reproduce this by adding remove_theme_support( 'widgets-block-editor' ); to my theme's functions.php. I can access the Widgets section in the Customizer but attempting to open any of the widgets for editing causes Uncaught TypeError: control.onChangeSectionExpanded is not a function to appear in the browser console.

@noisysocks noisysocks changed the title Customizer: legacy “Widgets” section is missing when a theme opts-out of the new block-based “Widgets” screen. Customizer: Error in console after opening a widget area when a theme opts-out of the new block-based “Widgets” screen May 17, 2021
@kevin940726 kevin940726 self-assigned this Jun 16, 2021
@kevin940726
Copy link
Member

remove_theme_support( 'widgets-block-editor' ) doesn't seem to work at all now. I opened trac-53424 to track it.

@getdave
Copy link
Contributor

getdave commented Jun 24, 2021

Looks like this was fixed in WordPress/wordpress-develop#1382.

More details in Trac.

https://core.trac.wordpress.org/ticket/53424#ticket

Can we close this one out now @noisysocks?

@kevin940726 kevin940726 removed their assignment Jun 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Widgets Screen The block-based screen that replaced widgets.php. [Type] Bug An existing feature does not function as intended
Projects
None yet
9 participants