Customize: Fix `focus()` to collapse child panels and show parent panel.
When a child panel is open, `wp.customize.panel('parent_panel').focus()` (e.g. `'parent_parent'` might be `'nav_menus'`) collapses the child panel(s) to show the parent panel. Follow-up to [30102], [31920], [38648]. Props celloexpressions, costdev, dlh, hareesh-pillai, hellofromTonya, westonruter, wpweaver. Fixes #34436. Built from https://develop.svn.wordpress.org/trunk@52003 git-svn-id: http://core.svn.wordpress.org/trunk@51592 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
e2315352e9
commit
6a10d18458
|
@ -695,10 +695,22 @@
|
||||||
* @param {Function} [params.completeCallback]
|
* @param {Function} [params.completeCallback]
|
||||||
*/
|
*/
|
||||||
focus = function ( params ) {
|
focus = function ( params ) {
|
||||||
var construct, completeCallback, focus, focusElement;
|
var construct, completeCallback, focus, focusElement, sections;
|
||||||
construct = this;
|
construct = this;
|
||||||
params = params || {};
|
params = params || {};
|
||||||
focus = function () {
|
focus = function () {
|
||||||
|
// If a child section is currently expanded, collapse it.
|
||||||
|
if ( construct.extended( api.Panel ) ) {
|
||||||
|
sections = construct.sections();
|
||||||
|
if ( 1 < sections.length ) {
|
||||||
|
sections.forEach( function ( section ) {
|
||||||
|
if ( section.expanded() ) {
|
||||||
|
section.collapse();
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var focusContainer;
|
var focusContainer;
|
||||||
if ( ( construct.extended( api.Panel ) || construct.extended( api.Section ) ) && construct.expanded && construct.expanded() ) {
|
if ( ( construct.extended( api.Panel ) || construct.extended( api.Section ) ) && construct.expanded && construct.expanded() ) {
|
||||||
focusContainer = construct.contentContainer;
|
focusContainer = construct.contentContainer;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.9-alpha-52002';
|
$wp_version = '5.9-alpha-52003';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue