Widgets: Add missing open class for expanded widgets in Customizer; utilize open class for expansion detection in Text and Media widgets.

Fixes #41625.


git-svn-id: https://develop.svn.wordpress.org/trunk@41249 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Weston Ruter 2017-08-13 06:24:28 +00:00
parent 8b6b45c96b
commit 21f8256a27
3 changed files with 6 additions and 6 deletions

View File

@ -1400,6 +1400,7 @@
complete = function() {
self.container.removeClass( 'expanding' );
self.container.addClass( 'expanded' );
$widget.addClass( 'open' );
$toggleBtn.attr( 'aria-expanded', 'true' );
self.container.trigger( 'expanded' );
};
@ -1433,6 +1434,7 @@
complete = function() {
self.container.removeClass( 'collapsing' );
self.container.removeClass( 'expanded' );
$widget.removeClass( 'open' );
$toggleBtn.attr( 'aria-expanded', 'false' );
self.container.trigger( 'collapsed' );
};

View File

@ -1030,7 +1030,7 @@ wp.mediaWidgets = ( function( $ ) {
* @returns {void}
*/
component.handleWidgetAdded = function handleWidgetAdded( event, widgetContainer ) {
var fieldContainer, syncContainer, widgetForm, idBase, ControlConstructor, ModelConstructor, modelAttributes, widgetControl, widgetModel, widgetId, widgetInside, animatedCheckDelay = 50, renderWhenAnimationDone;
var fieldContainer, syncContainer, widgetForm, idBase, ControlConstructor, ModelConstructor, modelAttributes, widgetControl, widgetModel, widgetId, animatedCheckDelay = 50, renderWhenAnimationDone;
widgetForm = widgetContainer.find( '> .widget-inside > .form, > .widget-inside > form' ); // Note: '.form' appears in the customizer, whereas 'form' on the widgets admin screen.
idBase = widgetForm.find( '> .id_base' ).val();
widgetId = widgetForm.find( '> .widget-id' ).val();
@ -1088,9 +1088,8 @@ wp.mediaWidgets = ( function( $ ) {
* This ensures that the container's dimensions are fixed so that ME.js
* can initialize with the proper dimensions.
*/
widgetInside = widgetContainer.parent();
renderWhenAnimationDone = function() {
if ( widgetInside.is( ':animated' ) ) {
if ( ! widgetContainer.hasClass( 'open' ) ) {
setTimeout( renderWhenAnimationDone, animatedCheckDelay );
} else {
widgetControl.render();

View File

@ -354,7 +354,7 @@ wp.textWidgets = ( function( $ ) {
* @returns {void}
*/
component.handleWidgetAdded = function handleWidgetAdded( event, widgetContainer ) {
var widgetForm, idBase, widgetControl, widgetId, animatedCheckDelay = 50, widgetInside, renderWhenAnimationDone, fieldContainer, syncContainer;
var widgetForm, idBase, widgetControl, widgetId, animatedCheckDelay = 50, renderWhenAnimationDone, fieldContainer, syncContainer;
widgetForm = widgetContainer.find( '> .widget-inside > .form, > .widget-inside > form' ); // Note: '.form' appears in the customizer, whereas 'form' on the widgets admin screen.
idBase = widgetForm.find( '> .id_base' ).val();
@ -401,9 +401,8 @@ wp.textWidgets = ( function( $ ) {
* This ensures that the textarea is visible and an iframe can be embedded
* with TinyMCE being able to set contenteditable on it.
*/
widgetInside = widgetContainer.parent();
renderWhenAnimationDone = function() {
if ( widgetInside.is( ':animated' ) ) {
if ( ! widgetContainer.hasClass( 'open' ) ) {
setTimeout( renderWhenAnimationDone, animatedCheckDelay );
} else {
widgetControl.initializeEditor();