Make WordPress Core

Opened 5 years ago

Closed 13 months ago

#48890 closed defect (bug) (worksforme)

Twenty Twenty: Customizer Controls Uncaught Errors

Reported by: fmixell's profile fmixell Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.3
Component: Bundled Theme Keywords: has-patch has-screenshots reporter-feedback close
Focuses: javascript Cc:

Description

I noticed that the customizer.js file in the Twenty Twenty theme is loading in the customizer no matter if the theme is being edited or if a plugin is using the customizer. When using any plugin that takes advantage of the customizer you will see the attached type error.

Offending Code:

api.control( 'accent_hue_active' )

Uncaught TypeError: Cannot read property 'setting' of undefined. That's because plugins are loading their settings.

So far I've seen this cause issues with the jQuery UI Slider controls, they just won't load. Switching back to the TwentyNineteen theme or TwentySeventeen theme resolved the issue.

Adding a try catch block around this twenty twenty setting specific code solves the problem for me. Try catch is fully supported now so I think this could be a great, minimal code, solution to this bug.

Attachments (2)

48890.custom-setting-uncaught-typeerror.png (56.4 KB) - added by fmixell 5 years ago.
Screenshot of error
customize.diff (1.6 KB) - added by fmixell 5 years ago.
Patch

Download all attachments as: .zip

Change History (7)

@fmixell
5 years ago

Screenshot of error

@fmixell
5 years ago

Patch

#1 @dlh
5 years ago

Hi @fmixell, and welcome to WordPress Trac!

Can you provide a code snippet or a list of steps that can be used to replicate this bug?

A try/catch block would eliminate the error, but it would also mean that the Customizer logic in the theme might never run. If possible, I think it would be preferable to wrap the logic in the Customizer's built-in ready event so it will fire once the Customizer API is available. At a glance, Twenty Nineteen's customize-controls.js might be a useful guide to this approach.

This ticket was mentioned in Slack in #core-customize by dlh. View the logs.


4 years ago

#3 in reply to: ↑ description @noisysocks
4 years ago

  • Keywords reporter-feedback added

Replying to fmixell:

When using any plugin that takes advantage of the customizer you will see the attached type error.

Do you have an example of a plugin which causes this error?

I'm not able to see the error locally, and without a reliable way to see it, I'm hesitant to commit a fix.

#4 @karmatosed
13 months ago

  • Keywords close added

Hi @fmixell I also am finding myself unable to see the error locally just like @noisysocks. This gives me the same feeling as they had of not being so keen to commit the fix without getting to see it first. That isn't saying it's not an issue, it is important for us to be able to reproduce though first.

As a result of the time taken so far and the lack of steps so far, I am going to recommend closing for now this ticket. We can always reopen if steps are given. Thank you everyone for collaborating on this.

#5 @karmatosed
13 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed

Let's close this for now, thank you everyone.

Note: See TracTickets for help on using tickets.