WordPress.org

Make WordPress Core

Opened 3 months ago

Last modified 3 months ago

#43556 new defect (bug)

Ensure only sidebar sections are considered when comparing against registered sidebars in Customizer

Reported by: flixos90 Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 4.1
Component: Customize Keywords: has-patch
Focuses: javascript Cc:

Description

In the Customizer's widgets panel, commonly sections for each registered sidebar are added. However, it is possible to also register regular sections to it, for example it may be useful to add one general settings section related to more general sidebar behavior.

For the most part this works seamlessly, there is just one detail I noticed. Commonly a notice will show in the Customizer if there is at least one registered sidebar that cannot be displayed for the currently previewed page. However this check counts all sections in the panel and compares them to the number of registered sidebars, where it should actually only count the sections that are actually intended to represent sidebars.

In my personal example, I added one additional section of type default, and there was one section of type sidebar which could not be displayed for the currently previewed page. However, since my default section was active, the count matched the registered sidebar count again, causing the notice to falsely not display.

Attachments (1)

43556.diff (491 bytes) - added by flixos90 3 months ago.

Download all attachments as: .zip

Change History (4)

@flixos90
3 months ago

#1 @flixos90
3 months ago

  • Keywords has-patch added; needs-patch removed

43556.diff ensures that only sections of the type sidebar are counted, to fix this bug.

#2 @joyously
3 months ago

I think I was seeing this same thing, only I wasn't creating other sections or sidebars, so I was thinking it was counting the Inactive Widget Area when it shouldn't. Does your patch account for that?

#3 @westonruter
3 months ago

  • Milestone changed from Awaiting Review to Future Release

43556.diff makes sense to me.

I was thinking it was counting the Inactive Widget Area when it shouldn't

@joyously There shouldn't be a section registered for inactive widget areas: https://github.com/WordPress/wordpress-develop/blob/7c2f975/src/wp-includes/class-wp-customize-widgets.php#L428-L468

There _is_ as setting registered for the inactive widgets sidebar, however.

Note: See TracTickets for help on using tickets.