WordPress.org

Make WordPress Core

Opened 12 months ago

Closed 12 months ago

Last modified 10 months ago

#38561 closed defect (bug) (fixed)

Custom header sections show in the Customizer without any choices

Reported by: bradyvercher Owned by: westonruter
Milestone: Priority: normal
Severity: normal Version: 4.6
Component: Customize Keywords: has-patch
Focuses: Cc:

Description

The "Previously uploaded" and "Suggested" titles in the "Header Images" section are always showing in the Customizer, even when they don't have any options available. They were hidden when empty in previous versions.

The attached screenshot when using Twenty Fifteen should help clarify.

Attachments (3)

empty-header-sections.png (61.3 KB) - added by bradyvercher 12 months ago.
38561.diff (3.0 KB) - added by bradyvercher 12 months ago.
38561.1.diff (1.1 KB) - added by bradyvercher 12 months ago.

Download all attachments as: .zip

Change History (10)

@bradyvercher
12 months ago

#1 @bradyvercher
12 months ago

It looks like this broke in [37476] when the DOM was changed to insert a notification container after the title. 38561.diff wraps the sections in a container to fix the previous behavior and adds some much needed spacing between the sections.

Last edited 12 months ago by bradyvercher (previous) (diff)

#2 @westonruter
12 months ago

@bradyvercher The injection of the notifications container is done as a fallback in case the control didn't include the container itself. So you can add the notifications container to the control's content template to specifically control where it appears.

#3 @bradyvercher
12 months ago

  • Keywords has-patch added

Thanks @westonruter! 38561.1.diff adds the notification container to the header control instead. On closer inspection, that prevents it from being duplicated and injected in the wrong place as well.

#4 @westonruter
12 months ago

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

@bradyvercher Your patch looks like it addresses the issue better than the patch on #38366, for which this is actually a duplicate.

#5 @westonruter
12 months ago

  • Owner set to westonruter
  • Resolution changed from duplicate to fixed

In 39145:

Customize: For Header Image, ensure "Previously uploaded" and "Suggested" headings are hidden when lists are empty.

Fixes regression introduced with the addition of control notifications in [37476]. The container element for notifications is injected after the .customize-control-title element if the .customize-control-notifications-container element does not already exist in the control's template. Also adds missing margin between current image and uploaded images.

Props bradyvercher.
See #34893.
Fixes #38561.

#6 @westonruter
12 months ago

#38366 was marked as a duplicate.

#7 @westonruter
10 months ago

#39375 was marked as a duplicate.

Note: See TracTickets for help on using tickets.