diff options
author | Joe Dolson <joedolson@git.wordpress.org> | 2024-12-22 20:44:06 +0000 |
---|---|---|
committer | Joe Dolson <joedolson@git.wordpress.org> | 2024-12-22 20:44:06 +0000 |
commit | d030306983076b1834fb9d6d25776d0b49112430 (patch) | |
tree | 8a5386fe2bcbf0c7707de6632d3cce02068fc10e /src/js/_enqueues/wp/customize/controls.js | |
parent | de76b6ee76b7052b2da246476cadc05c21686dd8 (diff) | |
download | wordpress-d030306983076b1834fb9d6d25776d0b49112430.tar.gz wordpress-d030306983076b1834fb9d6d25776d0b49112430.zip |
Customizer: Allow custom accordion items with obsolete structure.
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.
Props paullb, desrosj, sabernhardt, joedolson, jorbin.
Fixes #62494.
git-svn-id: https://develop.svn.wordpress.org/trunk@59555 602fd350-edb4-49c9-b593-d223f7449a82
Diffstat (limited to 'src/js/_enqueues/wp/customize/controls.js')
-rw-r--r-- | src/js/_enqueues/wp/customize/controls.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/js/_enqueues/wp/customize/controls.js b/src/js/_enqueues/wp/customize/controls.js index 1d402bc1c3..7a6e69cf3e 100644 --- a/src/js/_enqueues/wp/customize/controls.js +++ b/src/js/_enqueues/wp/customize/controls.js @@ -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; } @@ -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' ) ) { @@ -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; @@ -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; } @@ -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; |