mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
Customizer panels:
* Close all accordion sections when going in and out of panels. * Fix panel positioning when top-level Customizer controls are scrolled down. * Keyboard accessibility: only focus on visible elements and transfer between them as needed when navigating around panels. props celloexpressions. see #27406. git-svn-id: https://develop.svn.wordpress.org/trunk@29035 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
d1c4c6fd6e
commit
054e4b5e65
@ -69,26 +69,41 @@
|
||||
}
|
||||
|
||||
function panelSwitch( panel ) {
|
||||
var position,
|
||||
var position, scroll,
|
||||
section = panel.closest( '.accordion-section' ),
|
||||
container = section.closest( '.wp-full-overlay' ),
|
||||
siblings = container.find( '.accordion-section.open' ),
|
||||
overlay = section.closest( '.wp-full-overlay' ),
|
||||
container = section.closest( '.accordion-container' ),
|
||||
siblings = container.find( '.open' ),
|
||||
topPanel = overlay.find( '#customize-theme-controls > ul > .accordion-section > .accordion-section-title' ).add( '#customize-info > .accordion-section-title' ),
|
||||
backBtn = section.find( '.control-panel-back' ),
|
||||
panelTitle = section.find( '.accordion-section-title' ).first(),
|
||||
content = section.find( '.control-panel-content' );
|
||||
|
||||
if ( section.hasClass( 'current-panel' ) ) {
|
||||
section.toggleClass( 'current-panel' );
|
||||
container.toggleClass( 'in-sub-panel' );
|
||||
overlay.toggleClass( 'in-sub-panel' );
|
||||
content.delay( 180 ).hide( 0, function() {
|
||||
content.css( 'margin-top', 'inherit' ); // Reset
|
||||
} );
|
||||
topPanel.attr( 'tabindex', '0' );
|
||||
backBtn.attr( 'tabindex', '-1' );
|
||||
panelTitle.focus();
|
||||
container.scrollTop( 0 );
|
||||
} else {
|
||||
// Close all open sections in any accordion level.
|
||||
siblings.removeClass( 'open' );
|
||||
siblings.find( sectionContent ).show().slideUp( 0 );
|
||||
content.show( 0, function() {
|
||||
position = content.offset().top;
|
||||
content.css( 'margin-top', ( 45 - position ) );
|
||||
scroll = container.scrollTop();
|
||||
content.css( 'margin-top', ( 45 - position - scroll ) );
|
||||
section.toggleClass( 'current-panel' );
|
||||
container.toggleClass( 'in-sub-panel' );
|
||||
overlay.toggleClass( 'in-sub-panel' );
|
||||
container.scrollTop( 0 );
|
||||
} );
|
||||
topPanel.attr( 'tabindex', '-1' );
|
||||
backBtn.attr( 'tabindex', '0' );
|
||||
backBtn.focus();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -240,7 +240,7 @@ class WP_Customize_Panel extends WP_Customize_Section {
|
||||
?>
|
||||
<li id="accordion-section-<?php echo esc_attr( $this->id ); ?>" class="control-section control-panel accordion-section">
|
||||
<h3 class="accordion-section-title" tabindex="0"><?php echo esc_html( $this->title ); ?></h3>
|
||||
<span class="control-panel-back" tabindex="0"><span class="screen-reader-text">Back to Customize</span></span>
|
||||
<span class="control-panel-back" tabindex="-1"><span class="screen-reader-text">Back to Customize</span></span>
|
||||
<ul class="accordion-sub-container control-panel-content">
|
||||
<li class="accordion-section control-section<?php if ( empty( $this->description ) ) echo ' cannot-expand'; ?>">
|
||||
<div class="accordion-section-title" tabindex="0">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user