WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#34494 closed defect (bug) (invalid)

Customizer: wp.customize.section().focus() broken in 4.4 Beta 2

Reported by: wpweaver Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.4
Component: Customize Keywords:
Focuses: Cc:

Description

I am currently working on a new Customizer based version of my theme. I have implemented a popup menu to navigate to any part of the Customizer menu hierarchy using a JS script.

This menu uses wp.customize.section().focus() and wp.customize.panel().focus() extensively. I have been testing on 4.3.1, and these work as expected. After completing this new feature, I went to 4.4 Beta 2 to test, and the wp.customize.section().focus() portion of the popup menu is now completely non-functional.

It opens the parent panel of the section, and not the section. In 4.3, the call would option the section panel that included all the Options in the section. Now, just the section's parent.

This is a somewhat advanced use of these API calls I suspect. These calls are mentioned in the developer documentation, so I think they should continue to work in 4.4, but now they don't.

As this might be a bit difficult to test, I've attached the script in question, although I'm not sure how useful it is standalone. I can provide the current development version of my theme that clearly demonstrates the problem if necessary.

Attachments (1)

Customizer-Menu-5.js (33.1 KB) - added by wpweaver 5 years ago.
Script using wp.customizer.section().focus()

Download all attachments as: .zip

Change History (6)

@wpweaver
5 years ago

Script using wp.customizer.section().focus()

#2 @wpweaver
5 years ago

These two tickets might or might not be related as this one applies to only 4.4.

#3 @wpweaver
5 years ago

After more tweaking, I see the two tickets might indeed be related. And it also might be related to a bad width calculation on the section panel.

As of 4.4 Beta 2 - 35436, I am once again getting the section option menus to display from
wp.customizer.section().focus(). But we added some hacks to force the width calculation:

        jQuery('.accordion-section.current-panel').css('width','300px');	// hack for Customizer's bad width calculation
	wp.customize.section(sectionPanel).focus();

	jQuery('#wx-jumpmenu').css('display','none');
	jQuery('.accordion-section').css('width','');	// hack for Customizer's bad width calculation

After opening a section with .accordion-section.current-panel, the width is set to 100%, which should be 300px, but the calculated width in the DOM says 282px. The above hack fixes that. But this whole bad width on focus might be related.

So currently in the mentioned 4.4 beta, I can get the section panels to display, but now there is a blank space above the top item with the < back arrow and "Customizing > section name", under the top Save bar. At least some of the time.

Whatever the real problem, I am not getting identical behavior on 4.3.1 and 4.4 Beta 2.

Last edited 5 years ago by wpweaver (previous) (diff)

#4 @wpweaver
5 years ago

  • Keywords close added

After further testing, I am unable to reproduce this particular problem of opening section option panels. So this ticket should be closed.

However, #34436 remains as an issue.

I will also open a new ticket to describe the margin calculation issue, which also remains.

#5 @swissspidy
5 years ago

  • Keywords close removed
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.