mirror of
https://github.com/WordPress/WordPress.git
synced 2024-10-01 08:37:55 +02:00
Customize: Fix jumping behavior upon scrolling up when a sticky header has its description expanded.
Props delawski. See #34343, #41879. Fixes #41850. Built from https://develop.svn.wordpress.org/trunk@41679 git-svn-id: http://core.svn.wordpress.org/trunk@41513 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5087d26d2d
commit
d8d8a01134
@ -1315,7 +1315,9 @@
|
|||||||
}
|
}
|
||||||
content = meta.find( '.customize-section-description:first' );
|
content = meta.find( '.customize-section-description:first' );
|
||||||
content.toggleClass( 'open' );
|
content.toggleClass( 'open' );
|
||||||
content.slideToggle();
|
content.slideToggle( section.defaultExpandedArguments.duration, function() {
|
||||||
|
content.trigger( 'toggled' );
|
||||||
|
} );
|
||||||
$( this ).attr( 'aria-expanded', function( i, attr ) {
|
$( this ).attr( 'aria-expanded', function( i, attr ) {
|
||||||
return 'true' === attr ? 'false' : 'true';
|
return 'true' === attr ? 'false' : 'true';
|
||||||
});
|
});
|
||||||
@ -2558,10 +2560,14 @@
|
|||||||
var content = meta.find( '.customize-panel-description:first' );
|
var content = meta.find( '.customize-panel-description:first' );
|
||||||
if ( meta.hasClass( 'open' ) ) {
|
if ( meta.hasClass( 'open' ) ) {
|
||||||
meta.toggleClass( 'open' );
|
meta.toggleClass( 'open' );
|
||||||
content.slideUp( panel.defaultExpandedArguments.duration );
|
content.slideUp( panel.defaultExpandedArguments.duration, function() {
|
||||||
|
content.trigger( 'toggled' );
|
||||||
|
} );
|
||||||
$( this ).attr( 'aria-expanded', false );
|
$( this ).attr( 'aria-expanded', false );
|
||||||
} else {
|
} else {
|
||||||
content.slideDown( panel.defaultExpandedArguments.duration );
|
content.slideDown( panel.defaultExpandedArguments.duration, function() {
|
||||||
|
content.trigger( 'toggled' );
|
||||||
|
} );
|
||||||
meta.toggleClass( 'open' );
|
meta.toggleClass( 'open' );
|
||||||
$( this ).attr( 'aria-expanded', true );
|
$( this ).attr( 'aria-expanded', true );
|
||||||
}
|
}
|
||||||
@ -6411,10 +6417,14 @@
|
|||||||
|
|
||||||
if ( section.hasClass( 'open' ) ) {
|
if ( section.hasClass( 'open' ) ) {
|
||||||
section.toggleClass( 'open' );
|
section.toggleClass( 'open' );
|
||||||
content.slideUp( api.Panel.prototype.defaultExpandedArguments.duration );
|
content.slideUp( api.Panel.prototype.defaultExpandedArguments.duration, function() {
|
||||||
|
content.trigger( 'toggled' );
|
||||||
|
} );
|
||||||
$( this ).attr( 'aria-expanded', false );
|
$( this ).attr( 'aria-expanded', false );
|
||||||
} else {
|
} else {
|
||||||
content.slideDown( api.Panel.prototype.defaultExpandedArguments.duration );
|
content.slideDown( api.Panel.prototype.defaultExpandedArguments.duration, function() {
|
||||||
|
content.trigger( 'toggled' );
|
||||||
|
} );
|
||||||
section.toggleClass( 'open' );
|
section.toggleClass( 'open' );
|
||||||
$( this ).attr( 'aria-expanded', true );
|
$( this ).attr( 'aria-expanded', true );
|
||||||
}
|
}
|
||||||
@ -7365,7 +7375,7 @@
|
|||||||
*/
|
*/
|
||||||
(function initStickyHeaders() {
|
(function initStickyHeaders() {
|
||||||
var parentContainer = $( '.wp-full-overlay-sidebar-content' ),
|
var parentContainer = $( '.wp-full-overlay-sidebar-content' ),
|
||||||
changeContainer, getHeaderHeight, releaseStickyHeader, resetStickyHeader, positionStickyHeader,
|
changeContainer, updateHeaderHeight, releaseStickyHeader, resetStickyHeader, positionStickyHeader,
|
||||||
activeHeader, lastScrollTop;
|
activeHeader, lastScrollTop;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -7383,9 +7393,12 @@
|
|||||||
expandedPanel = api.state( 'expandedPanel' ).get(),
|
expandedPanel = api.state( 'expandedPanel' ).get(),
|
||||||
headerElement;
|
headerElement;
|
||||||
|
|
||||||
// Release previously active header element.
|
|
||||||
if ( activeHeader && activeHeader.element ) {
|
if ( activeHeader && activeHeader.element ) {
|
||||||
|
// Release previously active header element.
|
||||||
releaseStickyHeader( activeHeader.element );
|
releaseStickyHeader( activeHeader.element );
|
||||||
|
|
||||||
|
// Remove event listener in the previous panel or section.
|
||||||
|
activeHeader.element.find( '.description' ).off( 'toggled', updateHeaderHeight );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! newInstance ) {
|
if ( ! newInstance ) {
|
||||||
@ -7405,8 +7418,12 @@
|
|||||||
instance: newInstance,
|
instance: newInstance,
|
||||||
element: headerElement,
|
element: headerElement,
|
||||||
parent: headerElement.closest( '.customize-pane-child' ),
|
parent: headerElement.closest( '.customize-pane-child' ),
|
||||||
height: getHeaderHeight( headerElement )
|
height: headerElement.outerHeight()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Update header height whenever help text is expanded or collapsed.
|
||||||
|
activeHeader.element.find( '.description' ).on( 'toggled', updateHeaderHeight );
|
||||||
|
|
||||||
if ( expandedSection ) {
|
if ( expandedSection ) {
|
||||||
resetStickyHeader( activeHeader.element, activeHeader.parent );
|
resetStickyHeader( activeHeader.element, activeHeader.parent );
|
||||||
}
|
}
|
||||||
@ -7475,21 +7492,15 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get header height.
|
* Update active header height.
|
||||||
*
|
*
|
||||||
* @since 4.7.0
|
* @since 4.7.0
|
||||||
* @access private
|
* @access private
|
||||||
*
|
*
|
||||||
* @param {jQuery} headerElement Header element.
|
* @returns {void}
|
||||||
* @returns {number} Height.
|
|
||||||
*/
|
*/
|
||||||
getHeaderHeight = function( headerElement ) {
|
updateHeaderHeight = function() {
|
||||||
var height = headerElement.data( 'height' );
|
activeHeader.height = activeHeader.element.outerHeight();
|
||||||
if ( ! height ) {
|
|
||||||
height = headerElement.outerHeight();
|
|
||||||
headerElement.data( 'height', height );
|
|
||||||
}
|
|
||||||
return height;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -7945,7 +7956,8 @@
|
|||||||
if ( control && ! control.setting.get() ) {
|
if ( control && ! control.setting.get() ) {
|
||||||
section.container.find( '.section-meta .customize-section-description:first' )
|
section.container.find( '.section-meta .customize-section-description:first' )
|
||||||
.addClass( 'open' )
|
.addClass( 'open' )
|
||||||
.show();
|
.show()
|
||||||
|
.trigger( 'toggled' );
|
||||||
|
|
||||||
section.container.find( '.customize-help-toggle' ).attr( 'aria-expanded', 'true' );
|
section.container.find( '.customize-help-toggle' ).attr( 'aria-expanded', 'true' );
|
||||||
}
|
}
|
||||||
|
8
wp-admin/js/customize-controls.min.js
vendored
8
wp-admin/js/customize-controls.min.js
vendored
File diff suppressed because one or more lines are too long
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.9-alpha-41678';
|
$wp_version = '4.9-alpha-41679';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
Block a user