Make WordPress Core

Opened 7 years ago

Closed 6 years ago

Last modified 6 years ago

#43556 closed defect (bug) (fixed)

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

Reported by: flixos90's profile flixos90 Owned by: flixos90's profile flixos90
Milestone: 5.1 Priority: normal
Severity: normal Version: 4.1
Component: Customize Keywords: has-patch commit
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 7 years ago.

Download all attachments as: .zip

Change History (8)

@flixos90
7 years ago

#1 @flixos90
7 years 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
7 years 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
7 years 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.

#4 @flixos90
6 years ago

@westonruter Is this missing anything or good to go?

#5 @westonruter
6 years ago

  • Keywords commit added
  • Milestone changed from Future Release to 5.0

@flixos90 it looks good to go. Engage.

#6 @flixos90
6 years ago

  • Owner set to flixos90
  • Resolution set to fixed
  • Status changed from new to closed

In 43588:

Customize: Ensure that only sidebar sections are considered when comparing against sidebars.

In the Customizer a notice will show up if there is at least one registered sidebar with its section not being active. In order to achieve that, the count of registered sidebars is compared to the count of active sections in the Widgets panel. Prior to this change, the latter would incorrectly include any sections, even additional sections that do not correspond to a sidebar.

Fixes #43556.

#7 @flixos90
6 years ago

  • Milestone changed from 5.0 to 5.1
Note: See TracTickets for help on using tickets.