Skip to content

Commit

Permalink
Customizer: Allow custom accordion items with obsolete structure.
Browse files Browse the repository at this point in the history
In [59224], customizer accordion item HTML structure was changed to include a button element as the interactive control. However, some themes inject custom markup for panel headings.

Fix controls.js to handle both the new markup and the old markup, which is relatively common in themes.

Reviewed by jorbin.
Merges [59555] to the 6.7 branch.

Props paullb, desrosj, sabernhardt, joedolson, jorbin.
Fixes #62494.

Built from https://develop.svn.wordpress.org/branches/6.7@59758


git-svn-id: http://core.svn.wordpress.org/branches/6.7@59100 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
aaronjorbin committed Feb 4, 2025
1 parent f08889f commit 407857c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions wp-admin/js/customize-controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -1530,7 +1530,7 @@
}

// Expand/Collapse accordion sections on click.
section.container.find( '.accordion-section-title button, .customize-section-back' ).on( 'click keydown', function( event ) {
section.container.find( '.accordion-section-title button, .customize-section-back, .accordion-section-title[tabindex]' ).on( 'click keydown', function( event ) {
if ( api.utils.isKeydownButNotEnterEvent( event ) ) {
return;
}
Expand Down Expand Up @@ -1605,7 +1605,7 @@
content = section.contentContainer,
overlay = section.headContainer.closest( '.wp-full-overlay' ),
backBtn = content.find( '.customize-section-back' ),
sectionTitle = section.headContainer.find( '.accordion-section-title button' ).first(),
sectionTitle = section.headContainer.find( '.accordion-section-title button, .accordion-section-title[tabindex]' ).first(),
expand, panel;

if ( expanded && ! content.hasClass( 'open' ) ) {
Expand Down Expand Up @@ -2694,7 +2694,7 @@
container = section.headContainer.closest( '.wp-full-overlay-sidebar-content' ),
content = section.contentContainer,
backBtn = content.find( '.customize-section-back' ),
sectionTitle = section.headContainer.find( '.accordion-section-title button' ).first(),
sectionTitle = section.headContainer.find( '.accordion-section-title button, .accordion-section-title[tabindex]' ).first(),
body = $( document.body ),
expand, panel;

Expand Down Expand Up @@ -2833,7 +2833,7 @@
var meta, panel = this;

// Expand/Collapse accordion sections on click.
panel.headContainer.find( '.accordion-section-title button' ).on( 'click keydown', function( event ) {
panel.headContainer.find( '.accordion-section-title button, .accordion-section-title[tabindex]' ).on( 'click keydown', function( event ) {
if ( api.utils.isKeydownButNotEnterEvent( event ) ) {
return;
}
Expand Down Expand Up @@ -2937,7 +2937,7 @@
accordionSection = panel.contentContainer,
overlay = accordionSection.closest( '.wp-full-overlay' ),
container = accordionSection.closest( '.wp-full-overlay-sidebar-content' ),
topPanel = panel.headContainer.find( '.accordion-section-title button' ),
topPanel = panel.headContainer.find( '.accordion-section-title button, .accordion-section-title[tabindex]' ),
backBtn = accordionSection.find( '.customize-panel-back' ),
childSections = panel.sections(),
skipTransition;
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/js/customize-controls.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion wp-includes/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.7.2-alpha-59757';
$wp_version = '6.7.2-alpha-59758';

/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
Expand Down

0 comments on commit 407857c

Please sign in to comment.