Ticket #34391: 34391_5.diff
| File 34391_5.diff, 50.1 KB (added by , 9 years ago) |
|---|
-
src/wp-admin/css/common.css
diff --git a/src/wp-admin/css/common.css b/src/wp-admin/css/common.css index c699ad8..3d9014a 100644
a b img { 3330 3330 display: none; 3331 3331 } 3332 3332 3333 .control-section .accordion-section-title { 3333 .control-section .accordion-section-title, 3334 .customize-pane-child .accordion-section-title { 3334 3335 border-left: none; 3335 3336 border-right: none; 3336 3337 padding: 10px 10px 11px 14px; … … img { 3338 3339 background: #fff; 3339 3340 } 3340 3341 3341 .control-section .accordion-section-title:after { 3342 .control-section .accordion-section-title:after, 3343 .customize-pane-child .accordion-section-title:after { 3342 3344 top: 11px; 3343 3345 } 3344 3346 -
src/wp-admin/css/customize-controls.css
diff --git a/src/wp-admin/css/customize-controls.css b/src/wp-admin/css/customize-controls.css index 5118b60..51d9441 100644
a b body { 77 77 line-height: 24px; 78 78 } 79 79 80 #customize-controls .c ontrol-section.customize-section-title h3,81 #customize-controls .c ontrol-sectionh3.customize-section-title,80 #customize-controls .customize-pane-child .customize-section-title h3, 81 #customize-controls .customize-pane-child h3.customize-section-title, 82 82 #customize-controls .customize-info .panel-title { 83 83 font-size: 20px; 84 84 font-weight: 200; … … body { 229 229 box-sizing: border-box; 230 230 } 231 231 232 .wp-full-overlay #customize-controls .wp-full-overlay-sidebar-content { 233 -webkit-transform: translate3d(0, 0, 0); 234 transform: translate3d(0, 0, 0); /* Promote to separate layer to avoid full-screen repaints */ 235 } 236 237 #customize-info, 238 #customize-theme-controls .customize-pane-parent, 239 #customize-theme-controls .customize-pane-child { 240 overflow: visible; 241 width: 100%; 242 margin: 0; 243 padding: 0; 244 -webkit-box-sizing: border-box; 245 -moz-box-sizing: border-box; 246 box-sizing: border-box; 247 -webkit-transition: 0.36s -webkit-transform cubic-bezier(0.645, 0.045, 0.355, 1); 248 transition: 0.36s -webkit-transform cubic-bezier(0.645, 0.045, 0.355, 1); 249 transition: 0.36s transform cubic-bezier(0.645, 0.045, 0.355, 1); 250 transition: 0.36s transform cubic-bezier(0.645, 0.045, 0.355, 1), 0.36s -webkit-transform cubic-bezier(0.645, 0.045, 0.355, 1); /* easeInOutCubic */ 251 } 252 253 #customize-info, 254 #customize-theme-controls .customize-pane-parent { 255 position: relative; 256 visibility: visible; 257 height: auto; 258 max-height: none; 259 overflow: auto; 260 -webkit-transform: none; 261 -ms-transform: none; 262 transform: none; 263 } 264 265 #customize-theme-controls .customize-pane-child { 266 position: absolute; 267 top: 0; 268 left: 0; 269 visibility: hidden; 270 height: 0; 271 max-height: none; 272 overflow: hidden; 273 -webkit-transform: translateX(100%); 274 -ms-transform: translateX(100%); 275 transform: translateX(100%); 276 } 277 278 #customize-theme-controls .customize-pane-child.open, 279 #customize-theme-controls .customize-pane-child.current-panel, 280 #customize-theme-controls .customize-themes-panel.customize-pane-child.current-panel { 281 -webkit-transform: none; 282 -ms-transform: none; 283 transform: none; 284 } 285 286 #customize-theme-controls .customize-themes-panel.customize-pane-child, 287 .section-open #customize-theme-controls .customize-pane-parent, 288 .in-sub-panel #customize-theme-controls .customize-pane-parent, 289 .section-open #customize-info, 290 .in-sub-panel #customize-info, 291 .in-sub-panel.section-open #customize-theme-controls .customize-pane-child.current-panel, 292 .in-themes-panel #customize-theme-controls .customize-pane-parent, 293 .in-themes-panel #customize-info { 294 visibility: hidden; 295 height: 0; 296 overflow: hidden; 297 -webkit-transform: translateX(-100%); 298 -ms-transform: translateX(-100%); 299 transform: translateX(-100%); 300 } 301 302 .section-open #customize-theme-controls .customize-pane-parent.busy, 303 .in-sub-panel #customize-theme-controls .customize-pane-parent.busy, 304 .in-themes-panel #customize-theme-controls .customize-pane-parent.busy, 305 .section-open #customize-info.busy, 306 .in-sub-panel #customize-info.busy, 307 .in-themes-panel #customize-info.busy, 308 .busy.section-open.in-sub-panel #customize-theme-controls .customize-pane-child.current-panel, 309 #customize-theme-controls .customize-pane-child.open, 310 #customize-theme-controls .customize-pane-child.current-panel, 311 #customize-theme-controls .customize-pane-child.busy { 312 visibility: visible; 313 height: auto; 314 overflow: auto; 315 } 316 317 .in-themes-panel #customize-theme-controls .customize-pane-parent, 318 .in-themes-panel #customize-info { 319 -webkit-transform: translateX(100%); 320 -ms-transform: translateX(100%); 321 transform: translateX(100%); 322 } 323 324 #customize-theme-controls .customize-pane-child.accordion-section-content, 325 #customize-theme-controls .customize-pane-child.accordion-sub-container { 326 display: block; 327 overflow-x: hidden; 328 } 329 330 #customize-theme-controls .customize-pane-child.accordion-section-content { 331 padding: 12px; 332 } 333 232 334 .customize-section-description-container { 233 335 margin-bottom: 15px; 234 336 } … … h3.customize-section-title { 268 370 color: #555; 269 371 } 270 372 271 #customize-theme-controls {272 position: relative;273 left: 0;274 -webkit-transition: .18s left ease-in-out;275 transition: .18s left ease-in-out;276 }277 278 .ios #customize-theme-controls {279 -webkit-transition: left 0s;280 transition: left 0s;281 }282 283 .section-open #customize-info,284 .section-open #customize-theme-controls {285 left: -100%;286 }287 288 373 .accordion-sub-container.control-panel-content { 289 374 display: none; 290 375 position: absolute; 291 left: 100%;292 376 top: 0; 293 377 width: 100%; 294 -webkit-transition: left ease-in-out .18s;295 transition: left ease-in-out .18s;296 }297 298 .ios .accordion-sub-container.control-panel-content {299 -webkit-transition: left 0s;300 transition: left 0s;301 378 } 302 379 303 .accordion-sub-container.control-panel-content. animating{380 .accordion-sub-container.control-panel-content.busy { 304 381 display: block; 305 382 } 306 383 … … h3.customize-section-title { 343 420 -webkit-box-shadow: none; 344 421 box-shadow: none; 345 422 cursor: pointer; 346 -webkit-transition: left .18s ease-in-out,color .1s ease-in-out, background .1s ease-in-out;347 transition: left .18s ease-in-out,color .1s ease-in-out, background .1s ease-in-out;423 -webkit-transition: color .1s ease-in-out, background .1s ease-in-out; 424 transition: color .1s ease-in-out, background .1s ease-in-out; 348 425 } 349 426 350 427 .customize-section-back { 351 428 height: 74px; 352 429 } 353 430 354 .ios .customize-panel-back,355 .ios .customize-section-back {356 -webkit-transition: left 0s;357 transition: left 0s;358 }359 360 431 .ios .customize-panel-back { 361 432 display: none; 362 433 } … … h3.customize-section-title { 423 494 padding-left: 62px; 424 495 } 425 496 426 #customize-info,427 #customize-theme-controls > ul > .accordion-section {428 position: relative;429 left: 0;430 -webkit-transition: left ease-in-out .18s;431 transition: left ease-in-out .18s;432 }433 434 .ios #customize-info,435 .ios #customize-theme-controls > ul > .accordion-section {436 -webkit-transition: left 0s;437 transition: left 0s;438 }439 440 .in-sub-panel #customize-info,441 .in-sub-panel #customize-theme-controls > ul > .accordion-section {442 left: -100%;443 width: 100%;444 }445 446 .in-sub-panel #customize-theme-controls .accordion-section.current-panel {447 width: 100%;448 }449 450 #customize-theme-controls .control-section.current-panel {451 padding: 0;452 }453 454 #customize-theme-controls .control-section > h3.accordion-section-title {455 position: relative;456 left: 0;457 }458 459 #customize-theme-controls .control-section.current-panel > h3.accordion-section-title {460 left: -354px;461 -webkit-transition: left ease-in-out .18s;462 transition: left ease-in-out .18s;463 }464 465 .ios #customize-theme-controls .control-section.current-panel > h3.accordion-section-title {466 -webkit-transition: left 0s;467 transition: left 0s;468 }469 470 .wp-full-overlay.section-open #customize-controls .wp-full-overlay-sidebar-content {471 visibility: hidden;472 overflow-y: hidden;473 }474 475 .wp-full-overlay.section-open .wp-full-overlay-sidebar-content .accordion-section.open {476 visibility: visible;477 }478 479 .wp-full-overlay.section-open .wp-full-overlay-sidebar-content .accordion-section.open .accordion-section-content {480 overflow-y: auto;481 }482 483 497 p.customize-section-description { 484 498 font-style: normal; 485 499 margin-top: 22px; … … p.customize-section-description { 1005 1019 1006 1020 #customize-theme-controls .control-section-themes > .accordion-section-title:hover, /* Not a focusable element. */ 1007 1021 #customize-theme-controls .control-section-themes > .accordion-section-title { 1008 margin: 15px 0;1022 margin: 0 0 15px; 1009 1023 } 1010 1024 1011 .customize-themes-panel .accordion-section-title {1025 #customize-controls .customize-themes-panel .accordion-section-title { 1012 1026 margin: 15px -8px; 1013 1027 } 1014 1028 1015 .control-section-themes .accordion-section-title { 1029 #customize-controls .control-section-themes .accordion-section-title, 1030 #customize-controls .customize-themes-panel .accordion-section-title { 1016 1031 padding-right: 100px; /* Space for the button */ 1017 1032 } 1018 1033 1019 .control-section-themes .accordion-section-title span.customize-action,1034 #customize-controls .control-section-themes .accordion-section-title span.customize-action, 1020 1035 #customize-controls .customize-section-title span.customize-action { 1021 1036 font-size: 13px; 1022 1037 display: block; 1023 1038 font-weight: 400; 1024 1039 } 1025 1040 1026 .control-section-themes .accordion-section-title .change-theme,1027 .control-section-themes.accordion-section-title .customize-theme {1041 #customize-controls .control-section-themes .accordion-section-title .change-theme, 1042 #customize-controls .customize-themes-panel .accordion-section-title .customize-theme { 1028 1043 position: absolute; 1029 1044 right: 10px; 1030 1045 top: 50%; … … p.customize-section-description { 1032 1047 font-weight: 400; 1033 1048 } 1034 1049 1035 .control-section-themes .accordion-section-title:before {1050 #customize-controls .control-section-themes .accordion-section-title:before { 1036 1051 display: none; 1037 1052 } 1038 1053 1039 .customize-themes-panel { 1040 display: none; 1054 #customize-controls .customize-themes-panel { 1041 1055 padding: 0 8px; 1042 1056 background: #f1f1f1; 1043 1057 -webkit-box-sizing: border-box; … … p.customize-section-description { 1045 1059 box-sizing: border-box; 1046 1060 } 1047 1061 1048 .customize-themes-panel .accordion-section-title:first-child {1062 #customize-controls .customize-themes-panel .accordion-section-title:first-child { 1049 1063 margin-top: 0; 1050 1064 } 1051 1065 … … p.customize-section-description { 1054 1068 font-weight: 600; 1055 1069 } 1056 1070 1057 .customize-themes-panel > h2 {1071 #customize-controls .customize-themes-panel > h2 { 1058 1072 padding: 15px 8px 0 8px; 1059 1073 } 1060 1074 1061 .control-section.open .customize-themes-panel {1062 display: block;1063 }1064 1065 1075 #customize-theme-controls .customize-themes-panel .accordion-section-content { 1066 1076 background: transparent; 1067 1077 display: block; … … p.customize-section-description { 1107 1117 width: 100%; 1108 1118 } 1109 1119 1110 #accordion-section-themes .accordion-section-title:after { 1120 .control-section-themes .accordion-section-title:after, 1121 .customize-themes-panel .accordion-section-title:after { 1111 1122 display: none; 1112 1123 } 1113 1124 1114 #customize-theme-controls .control-section-themes.current-panel > h3.accordion-section-title {1115 left: 0;1116 }1117 1118 1125 .customize-themes-panel.control-panel-content { 1119 position: absolute;1120 left: -100%;1121 top: 0;1122 width: 100%;1123 1126 border-top: 1px solid #ddd; 1124 1127 } 1125 1128 1126 .in-themes-panel #customize-info,1127 .in-themes-panel #customize-theme-controls > ul > .accordion-section {1128 left: 100%;1129 }1130 1131 1129 /* Details View */ 1132 1130 .wp-customizer .theme-overlay { 1133 1131 display: none; … … p.customize-section-description { 1161 1159 text-align: right; /* Because there's only one action, match the pattern of media modals and right-align the action. */ 1162 1160 } 1163 1161 1164 .modal-open .in-themes-panel #customize-controls .wp-full-overlay-sidebar-content { 1165 overflow: visible; /* Prevent the top-level Customizer controls from becoming visible when elements on the right of the details modal are focused. */ 1162 .in-themes-panel #customize-controls .wp-full-overlay-sidebar-content { 1163 -webkit-transform: none; 1164 -ms-transform: none; 1165 transform: none; /* Prevent creating new stacking contexts and containing blocks for themes modal. */ 1166 1166 } 1167 1167 1168 1168 .ie8 .wp-customizer .theme-overlay .theme-header, -
src/wp-admin/css/customize-nav-menus.css
diff --git a/src/wp-admin/css/customize-nav-menus.css b/src/wp-admin/css/customize-nav-menus.css index e2d5b46..b4228db 100644
a b 381 381 .reordering .menu-item-depth-10 > .menu-item-bar { margin-right: 150px; } 382 382 .reordering .menu-item-depth-11 > .menu-item-bar { margin-right: 165px; } 383 383 384 .control-section-nav_menu .menu .menu-item-edit-active {384 .control-section-nav_menu.menu .menu-item-edit-active { 385 385 margin-left: 0; 386 386 } 387 387 388 .control-section-nav_menu .menu .menu-item-edit-active .menu-item-bar {388 .control-section-nav_menu.menu .menu-item-edit-active .menu-item-bar { 389 389 margin-right: 0; 390 390 } 391 391 392 .control-section-nav_menu .menu .sortable-placeholder {392 .control-section-nav_menu.menu .sortable-placeholder { 393 393 margin-top: 0; 394 394 margin-bottom: 1px; 395 395 max-width: -webkit-calc(100% - 2px); … … 403 403 float: none; 404 404 } 405 405 406 .control-section-nav_menu .menu ul.menu-item-transport .menu-item-bar {406 .control-section-nav_menu.menu ul.menu-item-transport .menu-item-bar { 407 407 margin-top: 0; 408 408 } 409 409 -
src/wp-admin/customize.php
diff --git a/src/wp-admin/customize.php b/src/wp-admin/customize.php index bd8e118..6c0b20d 100644
a b 142 142 </div> 143 143 144 144 <div id="customize-theme-controls"> 145 <ul ><?php // Panels and sections are managed here via JavaScript ?></ul>145 <ul class="customize-pane-parent"><?php // Panels and sections are managed here via JavaScript ?></ul> 146 146 </div> 147 147 </div> 148 148 </div> -
src/wp-admin/js/customize-controls.js
diff --git a/src/wp-admin/js/customize-controls.js b/src/wp-admin/js/customize-controls.js index 7078cfd..cdd284d 100644
a b 1 1 /* global _wpCustomizeHeader, _wpCustomizeBackground, _wpMediaViewsL10n, MediaElementPlayer */ 2 2 (function( exports, $ ){ 3 var Container, focus, api = wp.customize;3 var Container, focus, normalizedTransitionendEventName, api = wp.customize; 4 4 5 5 /** 6 6 * A Customizer Setting. … … 101 101 params = params || {}; 102 102 focus = function () { 103 103 var focusContainer; 104 if ( construct.extended( api.Panel ) && construct.expanded && construct.expanded() ) { 105 focusContainer = construct.container.find( 'ul.control-panel-content' ); 106 } else if ( construct.extended( api.Section ) && construct.expanded && construct.expanded() ) { 107 focusContainer = construct.container.find( 'ul.accordion-section-content' ); 104 if ( ( construct.extended( api.Panel ) || construct.extended( api.Section ) ) && construct.expanded && construct.expanded() ) { 105 focusContainer = construct.contentContainer; 108 106 } else { 109 107 focusContainer = construct.container; 110 108 } … … 188 186 }; 189 187 190 188 /** 189 * Return browser supported `transitionend` event name. 190 * 191 * @since 4.7.0 192 * 193 * @returns {string|null} Normalized `transitionend` event name or null if CSS transitions are not supported. 194 */ 195 normalizedTransitionendEventName = (function () { 196 var el, transitions, prop; 197 el = document.createElement( 'div' ); 198 transitions = { 199 'transition' : 'transitionend', 200 'OTransition' : 'oTransitionEnd', 201 'MozTransition' : 'transitionend', 202 'WebkitTransition': 'webkitTransitionEnd' 203 }; 204 prop = _.find( _.keys( transitions ), function( prop ) { 205 return ! _.isUndefined( el.style[ prop ] ); 206 } ); 207 if ( prop ) { 208 return transitions[ prop ]; 209 } else { 210 return null; 211 } 212 })(); 213 214 /** 191 215 * Base class for Panel and Section. 192 216 * 193 217 * @since 4.1.0 … … 238 262 if ( 0 === container.container.length ) { 239 263 container.container = $( container.getContainer() ); 240 264 } 265 container.headContainer = container.container; 266 container.contentContainer = container._getContent(); 267 container.container = container.container.add( container.contentContainer ); 241 268 242 269 container.deferred = { 243 270 embedded: new $.Deferred() … … 325 352 * @param {Object} args.completeCallback 326 353 */ 327 354 onChangeActive: function( active, args ) { 328 var duration, construct = this, expandedOtherPanel; 355 var construct = this, 356 headContainer = construct.headContainer, 357 duration, expandedOtherPanel; 358 329 359 if ( args.unchanged ) { 330 360 if ( args.completeCallback ) { 331 361 args.completeCallback(); … … 352 382 } 353 383 } 354 384 355 if ( ! $.contains( document, construct.container[0]) ) {385 if ( ! $.contains( document, headContainer ) ) { 356 386 // jQuery.fn.slideUp is not hiding an element if it is not in the DOM 357 construct.container.toggle( active );387 headContainer.toggle( active ); 358 388 if ( args.completeCallback ) { 359 389 args.completeCallback(); 360 390 } 361 391 } else if ( active ) { 362 construct.container.stop( true, true ).slideDown( duration, args.completeCallback );392 headContainer.stop( true, true ).slideDown( duration, args.completeCallback ); 363 393 } else { 364 394 if ( construct.expanded() ) { 365 395 construct.collapse({ 366 396 duration: duration, 367 397 completeCallback: function() { 368 construct.container.stop( true, true ).slideUp( duration, args.completeCallback );398 headContainer.stop( true, true ).slideUp( duration, args.completeCallback ); 369 399 } 370 400 }); 371 401 } else { 372 construct.container.stop( true, true ).slideUp( duration, args.completeCallback );402 headContainer.stop( true, true ).slideUp( duration, args.completeCallback ); 373 403 } 374 404 } 375 376 // Recalculate the margin-top immediately, not waiting for debounced reflow, to prevent momentary (100ms) vertical jiggle.377 if ( expandedOtherPanel ) {378 expandedOtherPanel._recalculateTopMargin();379 }380 405 }, 381 406 382 407 /** … … 483 508 }, 484 509 485 510 /** 511 * Animate container state change if transitions are supported by the browser. 512 * 513 * @since 4.7.0 514 * 515 * @param {function} completeCallback Function to be called after transition is completed. 516 * @returns {void} 517 * @private 518 */ 519 _animateChangeExpanded: function( completeCallback ) { 520 // Return if CSS transitions are not supported. 521 if ( ! normalizedTransitionendEventName ) { 522 if ( completeCallback ) { 523 completeCallback(); 524 } 525 return; 526 } 527 528 var construct = this, 529 content = construct.contentContainer, 530 overlay = content.closest( '.wp-full-overlay' ), 531 elements, transitionEndCallback; 532 533 // Determine set of elements that are affected by the animation. 534 elements = overlay.add( content ); 535 if ( _.isUndefined( construct.panel ) || '' === construct.panel() ) { 536 elements = elements.add( '#customize-info, .customize-pane-parent' ); 537 } 538 539 // Handle `transitionEnd` event. 540 transitionEndCallback = function( e ) { 541 if ( 2 !== e.eventPhase || ! $( e.target ).is( content ) ) { 542 return; 543 } 544 content.off( normalizedTransitionendEventName, transitionEndCallback ); 545 elements.removeClass( 'busy' ); 546 if ( completeCallback ) { 547 completeCallback(); 548 } 549 }; 550 content.on( normalizedTransitionendEventName, transitionEndCallback ); 551 elements.addClass( 'busy' ); 552 553 // Prevent screen flicker when pane has been scrolled before expanding. 554 _.defer( function() { 555 var container = content.closest( '.wp-full-overlay-sidebar-content' ), 556 currentScrollTop = container.scrollTop(), 557 previousScrollTop = content.data( 'previous-scrollTop' ) || 0, 558 expanded = construct.expanded(); 559 560 if ( expanded && 0 < currentScrollTop ) { 561 content.css( 'top', currentScrollTop + 'px' ); 562 content.data( 'previous-scrollTop', currentScrollTop ); 563 } else if ( ! expanded && 0 < currentScrollTop + previousScrollTop ) { 564 content.css( 'top', previousScrollTop - currentScrollTop + 'px' ); 565 container.scrollTop( previousScrollTop ); 566 } 567 } ); 568 }, 569 570 /** 486 571 * Bring the container into view and then expand this and bring it into view 487 572 * @param {Object} [params] 488 573 */ … … 507 592 } 508 593 509 594 return '<li></li>'; 595 }, 596 597 /** 598 * Find content element, relate it to the parent container with `aria-owns`, detach and return. 599 * 600 * @since 4.7.0 601 * 602 * @returns {jQuery} Detached content element. 603 * @private 604 */ 605 _getContent: function() { 606 var construct = this, 607 container = construct.container, 608 content = container.find( '.accordion-section-content, .control-panel-content' ).first(), 609 contentId = 'sub-' + container.attr( 'id' ), 610 ownedElements = contentId, 611 alreadyOwnedElements = container.attr( 'aria-owns' ); 612 613 if ( alreadyOwnedElements ) { 614 ownedElements = ownedElements + ' ' + alreadyOwnedElements; 615 } 616 container.attr( 'aria-owns', ownedElements ); 617 618 return content.detach().attr( { 619 'id': contentId, 620 'class': 'customize-pane-child ' + content.attr( 'class' ) + ' ' + container.attr( 'class' ) 621 } ); 510 622 } 511 623 }); 512 624 … … 552 664 section.id = id; 553 665 section.panel = new api.Value(); 554 666 section.panel.bind( function ( id ) { 555 $( section. container ).toggleClass( 'control-subsection', !! id );667 $( section.headContainer ).toggleClass( 'control-subsection', !! id ); 556 668 }); 557 669 section.panel.set( section.params.panel || '' ); 558 670 api.utils.bubbleChildValueChanges( section, [ 'panel' ] ); … … 569 681 * @since 4.1.0 570 682 */ 571 683 embed: function () { 572 var section = this, inject; 684 var inject, 685 section = this, 686 container = $( '#customize-theme-controls' ); 573 687 574 688 // Watch for changes to the panel state 575 689 inject = function ( panelId ) { … … 579 693 api.panel( panelId, function ( panel ) { 580 694 // The panel has been registered, wait for it to become ready/initialized 581 695 panel.deferred.embedded.done( function () { 582 parentContainer = panel.container.find( 'ul:first' ); 583 if ( ! section.container.parent().is( parentContainer ) ) { 584 parentContainer.append( section.container ); 696 parentContainer = panel.contentContainer; 697 if ( ! section.headContainer.parent().is( parentContainer ) ) { 698 parentContainer.append( section.headContainer ); 699 } 700 if ( ! section.contentContainer.parent().is( section.headContainer ) ) { 701 container.append( section.contentContainer ); 585 702 } 586 703 section.deferred.embedded.resolve(); 587 704 }); 588 705 } ); 589 706 } else { 590 707 // There is no panel, so embed the section in the root of the customizer 591 parentContainer = $( '#customize-theme-controls' ).children( 'ul' ); // @todo This should be defined elsewhere, and to be configurable 592 if ( ! section.container.parent().is( parentContainer ) ) { 593 parentContainer.append( section.container ); 708 parentContainer = $( '.customize-pane-parent' ); // @todo This should be defined elsewhere, and to be configurable 709 if ( ! section.headContainer.parent().is( parentContainer ) ) { 710 parentContainer.append( section.headContainer ); 711 } 712 if ( ! section.contentContainer.parent().is( section.headContainer ) ) { 713 container.append( section.contentContainer ); 594 714 } 595 715 section.deferred.embedded.resolve(); 596 716 } 597 717 }; 598 718 section.panel.bind( inject ); 599 719 inject( section.panel.get() ); // Since a section may never get a panel, assume that it won't ever get one 600 601 section.deferred.embedded.done(function() {602 // Fix the top margin after reflow.603 api.bind( 'pane-contents-reflowed', _.debounce( function() {604 section._recalculateTopMargin();605 }, 100 ) );606 });607 720 }, 608 721 609 722 /** … … 669 782 */ 670 783 onChangeExpanded: function ( expanded, args ) { 671 784 var section = this, 672 container = section.container.closest( '.wp-full-overlay-sidebar-content' ), 673 content = section.container.find( '.accordion-section-content' ), 674 overlay = section.container.closest( '.wp-full-overlay' ), 675 backBtn = section.container.find( '.customize-section-back' ), 676 sectionTitle = section.container.find( '.accordion-section-title' ).first(), 677 headerActionsHeight = $( '#customize-header-actions' ).height(), 678 resizeContentHeight, expand, position, scroll; 785 container = section.headContainer.closest( '.wp-full-overlay-sidebar-content' ), 786 content = section.contentContainer, 787 overlay = section.headContainer.closest( '.wp-full-overlay' ), 788 backBtn = content.find( '.customize-section-back' ), 789 sectionTitle = section.headContainer.find( '.accordion-section-title' ).first(), 790 expand; 679 791 680 if ( expanded && ! section.container.hasClass( 'open' ) ) {792 if ( expanded && ! content.hasClass( 'open' ) ) { 681 793 682 794 if ( args.unchanged ) { 683 795 expand = args.completeCallback; 684 796 } else { 685 container.scrollTop( 0 ); 686 resizeContentHeight = function() { 687 var matchMedia, offset; 688 matchMedia = window.matchMedia || window.msMatchMedia; 689 offset = 90; // 45px for customize header actions + 45px for footer actions. 690 691 // No footer on small screens. 692 if ( matchMedia && matchMedia( '(max-width: 640px)' ).matches ) { 693 offset = 45; 694 } 695 content.css( 'height', ( window.innerHeight - offset ) ); 696 }; 697 expand = function() { 698 section.container.addClass( 'open' ); 699 overlay.addClass( 'section-open' ); 700 position = content.offset().top; 701 scroll = container.scrollTop(); 702 content.css( 'margin-top', ( headerActionsHeight - position - scroll ) ); 703 resizeContentHeight(); 704 sectionTitle.attr( 'tabindex', '-1' ); 705 backBtn.attr( 'tabindex', '0' ); 706 backBtn.focus(); 707 if ( args.completeCallback ) { 708 args.completeCallback(); 709 } 797 expand = $.proxy( function() { 798 section._animateChangeExpanded( function() { 799 sectionTitle.attr( 'tabindex', '-1' ); 800 backBtn.attr( 'tabindex', '0' ); 710 801 711 // Fix the height after browser resize. 712 $( window ).on( 'resize.customizer-section', _.debounce( resizeContentHeight, 100 ) ); 802 backBtn.focus(); 803 content.css( 'top', '' ); 804 container.scrollTop( 0 ); 713 805 714 setTimeout( _.bind( section._recalculateTopMargin, section ), 0 ); 715 }; 806 if ( args.completeCallback ) { 807 args.completeCallback(); 808 } 809 } ); 810 811 content.addClass( 'open' ); 812 overlay.addClass( 'section-open' ); 813 }, this ); 716 814 } 717 815 718 816 if ( ! args.allowMultiple ) { … … 735 833 expand(); 736 834 } 737 835 738 } else if ( ! expanded && section.container.hasClass( 'open' ) ) { 739 section.container.removeClass( 'open' ); 836 } else if ( ! expanded && content.hasClass( 'open' ) ) { 837 section._animateChangeExpanded( function() { 838 backBtn.attr( 'tabindex', '-1' ); 839 sectionTitle.attr( 'tabindex', '0' ); 840 841 sectionTitle.focus(); 842 content.css( 'top', '' ); 843 844 if ( args.completeCallback ) { 845 args.completeCallback(); 846 } 847 } ); 848 849 content.removeClass( 'open' ); 740 850 overlay.removeClass( 'section-open' ); 741 content.css( 'margin-top', '' ); 742 container.scrollTop( 0 ); 743 backBtn.attr( 'tabindex', '-1' ); 744 sectionTitle.attr( 'tabindex', '0' ); 745 sectionTitle.focus(); 746 if ( args.completeCallback ) { 747 args.completeCallback(); 748 } 749 $( window ).off( 'resize.customizer-section' ); 851 750 852 } else { 751 853 if ( args.completeCallback ) { 752 854 args.completeCallback(); 753 855 } 754 856 } 755 },756 757 /**758 * Recalculate the top margin.759 *760 * @since 4.4.0761 * @private762 */763 _recalculateTopMargin: function() {764 var section = this, content, offset, headerActionsHeight;765 content = section.container.find( '.accordion-section-content' );766 if ( 0 === content.length ) {767 return;768 }769 headerActionsHeight = $( '#customize-header-actions' ).height();770 offset = ( content.offset().top - headerActionsHeight );771 if ( 0 < offset ) {772 content.css( 'margin-top', ( parseInt( content.css( 'margin-top' ), 10 ) - offset ) );773 }774 857 } 775 858 }); 776 859 … … 948 1031 } 949 1032 950 1033 // Note: there is a second argument 'args' passed 951 var position, scroll, 952 panel = this, 953 section = panel.container.closest( '.accordion-section' ), 1034 var panel = this, 1035 section = panel.contentContainer, 954 1036 overlay = section.closest( '.wp-full-overlay' ), 955 1037 container = section.closest( '.wp-full-overlay-sidebar-content' ), 956 siblings = container.find( '.open' ),957 1038 customizeBtn = section.find( '.customize-theme' ), 958 changeBtn = section.find( '.change-theme' ), 959 content = section.find( '.control-panel-content' ); 960 961 if ( expanded ) { 1039 changeBtn = panel.headContainer.find( '.change-theme' ); 962 1040 1041 if ( expanded && ! section.hasClass( 'current-panel' ) ) { 963 1042 // Collapse any sibling sections/panels 964 1043 api.section.each( function ( otherSection ) { 965 1044 if ( otherSection !== panel ) { … … 970 1049 otherPanel.collapse( { duration: 0 } ); 971 1050 }); 972 1051 973 content.show( 0,function() {974 position = content.offset().top;975 scroll = container.scrollTop();976 content.css( 'margin-top', ( $( '#customize-header-actions' ).height() - position - scroll ) ); 977 section.addClass( 'current-panel');978 overlay.addClass( 'in-themes-panel' );1052 panel._animateChangeExpanded( function() { 1053 changeBtn.attr( 'tabindex', '-1' ); 1054 customizeBtn.attr( 'tabindex', '0' ); 1055 1056 customizeBtn.focus(); 1057 section.css( 'top', '' ); 979 1058 container.scrollTop( 0 ); 980 _.delay( panel.renderScreenshots, 10 ); // Wait for the controls 981 panel.$customizeSidebar.on( 'scroll.customize-themes-section', _.throttle( panel.renderScreenshots, 300 ) ); 1059 982 1060 if ( args.completeCallback ) { 983 1061 args.completeCallback(); 984 1062 } 985 1063 } ); 986 customizeBtn.focus(); 987 } else { 988 siblings.removeClass( 'open' ); 989 section.removeClass( 'current-panel' ); 990 overlay.removeClass( 'in-themes-panel' ); 991 panel.$customizeSidebar.off( 'scroll.customize-themes-section' ); 992 content.delay( 180 ).hide( 0, function() { 993 content.css( 'margin-top', 'inherit' ); // Reset 1064 1065 overlay.addClass( 'in-themes-panel' ); 1066 section.addClass( 'current-panel' ); 1067 1068 } else if ( ! expanded && section.hasClass( 'current-panel' ) ) { 1069 panel._animateChangeExpanded( function() { 1070 changeBtn.attr( 'tabindex', '0' ); 1071 customizeBtn.attr( 'tabindex', '-1' ); 1072 1073 changeBtn.focus(); 1074 section.css( 'top', '' ); 1075 994 1076 if ( args.completeCallback ) { 995 1077 args.completeCallback(); 996 1078 } 997 1079 } ); 998 customizeBtn.attr( 'tabindex', '0' );999 changeBtn.focus();1000 container.scrollTop( 0 );1001 }1002 },1003 1080 1004 /** 1005 * Recalculate the top margin. 1006 * 1007 * @since 4.4.0 1008 * @private 1009 */ 1010 _recalculateTopMargin: function() { 1011 api.Panel.prototype._recalculateTopMargin.call( this ); 1081 overlay.removeClass( 'in-themes-panel' ); 1082 section.removeClass( 'current-panel' ); 1083 } 1012 1084 }, 1013 1085 1014 1086 /** … … 1237 1309 */ 1238 1310 embed: function () { 1239 1311 var panel = this, 1240 parentContainer = $( '#customize-theme-controls > ul' ); // @todo This should be defined elsewhere, and to be configurable 1312 container = $( '#customize-theme-controls' ), 1313 parentContainer = $( '.customize-pane-parent' ); // @todo This should be defined elsewhere, and to be configurable 1241 1314 1242 if ( ! panel.container.parent().is( parentContainer ) ) { 1243 parentContainer.append( panel.container ); 1315 if ( ! panel.headContainer.parent().is( parentContainer ) ) { 1316 parentContainer.append( panel.headContainer ); 1317 } 1318 if ( ! panel.contentContainer.parent().is( panel.headContainer ) ) { 1319 container.append( panel.contentContainer ); 1244 1320 panel.renderContent(); 1245 1321 } 1246 1322 1247 api.bind( 'pane-contents-reflowed', _.debounce( function() {1248 panel._recalculateTopMargin();1249 }, 100 ) );1250 1251 1323 panel.deferred.embedded.resolve(); 1252 1324 }, 1253 1325 … … 1258 1330 var meta, panel = this; 1259 1331 1260 1332 // Expand/Collapse accordion sections on click. 1261 panel. container.find( '.accordion-section-title' ).on( 'click keydown', function( event ) {1333 panel.headContainer.find( '.accordion-section-title' ).on( 'click keydown', function( event ) { 1262 1334 if ( api.utils.isKeydownButNotEnterEvent( event ) ) { 1263 1335 return; 1264 1336 } … … 1289 1361 } 1290 1362 event.preventDefault(); // Keep this AFTER the key filter above 1291 1363 1292 meta = panel.container.find( '.panel-meta' );1293 1364 if ( meta.hasClass( 'cannot-expand' ) ) { 1294 1365 return; 1295 1366 } … … 1359 1430 } 1360 1431 1361 1432 // Note: there is a second argument 'args' passed 1362 var position, scroll, 1363 panel = this, 1364 accordionSection = panel.container.closest( '.accordion-section' ), 1433 var panel = this, 1434 accordionSection = panel.contentContainer, 1365 1435 overlay = accordionSection.closest( '.wp-full-overlay' ), 1366 1436 container = accordionSection.closest( '.wp-full-overlay-sidebar-content' ), 1367 siblings = container.find( '.open' ), 1368 topPanel = overlay.find( '#customize-theme-controls > ul > .accordion-section > .accordion-section-title' ), 1369 backBtn = accordionSection.find( '.customize-panel-back' ), 1370 panelTitle = accordionSection.find( '.accordion-section-title' ).first(), 1371 content = accordionSection.find( '.control-panel-content' ), 1372 headerActionsHeight = $( '#customize-header-actions' ).height(); 1373 1374 if ( expanded ) { 1437 topPanel = panel.headContainer.find( '.accordion-section-title' ), 1438 backBtn = accordionSection.find( '.customize-panel-back' ); 1375 1439 1440 if ( expanded && ! accordionSection.hasClass( 'current-panel' ) ) { 1376 1441 // Collapse any sibling sections/panels 1377 1442 api.section.each( function ( section ) { 1378 1443 if ( panel.id !== section.panel() ) { … … 1385 1450 } 1386 1451 }); 1387 1452 1388 content.show( 0, function() { 1389 content.parent().show(); 1390 position = content.offset().top; 1391 scroll = container.scrollTop(); 1392 content.css( 'margin-top', ( headerActionsHeight - position - scroll ) ); 1393 accordionSection.addClass( 'current-panel' ); 1394 overlay.addClass( 'in-sub-panel' ); 1453 panel._animateChangeExpanded( function() { 1454 topPanel.attr( 'tabindex', '-1' ); 1455 backBtn.attr( 'tabindex', '0' ); 1456 1457 backBtn.focus(); 1458 accordionSection.css( 'top', '' ); 1395 1459 container.scrollTop( 0 ); 1460 1396 1461 if ( args.completeCallback ) { 1397 1462 args.completeCallback(); 1398 1463 } 1399 1464 } ); 1400 topPanel.attr( 'tabindex', '-1' ); 1401 backBtn.attr( 'tabindex', '0' ); 1402 backBtn.focus(); 1403 panel._recalculateTopMargin(); 1404 } else { 1405 siblings.removeClass( 'open' ); 1406 accordionSection.removeClass( 'current-panel' ); 1407 overlay.removeClass( 'in-sub-panel' ); 1408 content.delay( 180 ).hide( 0, function() { 1409 content.css( 'margin-top', 'inherit' ); // Reset 1465 1466 overlay.addClass( 'in-sub-panel' ); 1467 accordionSection.addClass( 'current-panel' ); 1468 1469 } else if ( ! expanded && accordionSection.hasClass( 'current-panel' ) ) { 1470 panel._animateChangeExpanded( function() { 1471 topPanel.attr( 'tabindex', '0' ); 1472 backBtn.attr( 'tabindex', '-1' ); 1473 1474 topPanel.focus(); 1475 accordionSection.css( 'top', '' ); 1476 1410 1477 if ( args.completeCallback ) { 1411 1478 args.completeCallback(); 1412 1479 } 1413 1480 } ); 1414 topPanel.attr( 'tabindex', '0' );1415 backBtn.attr( 'tabindex', '-1' );1416 panelTitle.focus();1417 container.scrollTop( 0 );1418 }1419 },1420 1481 1421 /** 1422 * Recalculate the top margin. 1423 * 1424 * @since 4.4.0 1425 * @private 1426 */ 1427 _recalculateTopMargin: function() { 1428 var panel = this, headerActionsHeight, content, accordionSection; 1429 headerActionsHeight = $( '#customize-header-actions' ).height(); 1430 accordionSection = panel.container.closest( '.accordion-section' ); 1431 content = accordionSection.find( '.control-panel-content' ); 1432 content.css( 'margin-top', ( parseInt( content.css( 'margin-top' ), 10 ) - ( content.offset().top - headerActionsHeight ) ) ); 1482 overlay.removeClass( 'in-sub-panel' ); 1483 accordionSection.removeClass( 'current-panel' ); 1484 } 1433 1485 }, 1434 1486 1435 1487 /** … … 1449 1501 } else { 1450 1502 template = wp.template( 'customize-panel-default-content' ); 1451 1503 } 1452 if ( template && panel. container ) {1453 panel.cont ainer.find( '.accordion-sub-container' ).html( template( panel.params ) );1504 if ( template && panel.headContainer ) { 1505 panel.contentContainer.html( template( panel.params ) ); 1454 1506 } 1455 1507 } 1456 1508 }); … … 1626 1678 api.section( sectionId, function ( section ) { 1627 1679 // Wait for the section to be ready/initialized 1628 1680 section.deferred.embedded.done( function () { 1629 parentContainer = section.container.find( 'ul:first' );1681 parentContainer = ( section.contentContainer.is( 'ul' ) ) ? section.contentContainer : section.contentContainer.find( 'ul:first' ); 1630 1682 if ( ! control.container.parent().is( parentContainer ) ) { 1631 1683 parentContainer.append( control.container ); 1632 1684 control.renderContent(); … … 3542 3594 */ 3543 3595 api.reflowPaneContents = _.bind( function () { 3544 3596 3545 var appendContainer, activeElement, root Containers, rootNodes = [], wasReflowed = false;3597 var appendContainer, activeElement, rootHeadContainers, rootNodes = [], wasReflowed = false; 3546 3598 3547 3599 if ( document.activeElement ) { 3548 3600 activeElement = $( document.activeElement ); … … 3551 3603 // Sort the sections within each panel 3552 3604 api.panel.each( function ( panel ) { 3553 3605 var sections = panel.sections(), 3554 section Containers = _.pluck( sections, 'container' );3606 sectionHeadContainers = _.pluck( sections, 'headContainer' ); 3555 3607 rootNodes.push( panel ); 3556 appendContainer = panel.container.find( 'ul:first' );3557 if ( ! api.utils.areElementListsEqual( section Containers, appendContainer.children( '[id]' ) ) ) {3608 appendContainer = ( panel.contentContainer.is( 'ul' ) ) ? panel.contentContainer : panel.contentContainer.find( 'ul:first' ); 3609 if ( ! api.utils.areElementListsEqual( sectionHeadContainers, appendContainer.children( '[id]' ) ) ) { 3558 3610 _( sections ).each( function ( section ) { 3559 appendContainer.append( section. container );3611 appendContainer.append( section.headContainer ); 3560 3612 } ); 3561 3613 wasReflowed = true; 3562 3614 } … … 3569 3621 if ( ! section.panel() ) { 3570 3622 rootNodes.push( section ); 3571 3623 } 3572 appendContainer = section.container.find( 'ul:first' );3624 appendContainer = ( section.contentContainer.is( 'ul' ) ) ? section.contentContainer : section.contentContainer.find( 'ul:first' ); 3573 3625 if ( ! api.utils.areElementListsEqual( controlContainers, appendContainer.children( '[id]' ) ) ) { 3574 3626 _( controls ).each( function ( control ) { 3575 3627 appendContainer.append( control.container ); … … 3580 3632 3581 3633 // Sort the root panels and sections 3582 3634 rootNodes.sort( api.utils.prioritySort ); 3583 root Containers = _.pluck( rootNodes, 'container' );3584 appendContainer = $( '#customize-theme-controls ' ).children( 'ul' ); // @todo This should be defined elsewhere, and to be configurable3585 if ( ! api.utils.areElementListsEqual( root Containers, appendContainer.children() ) ) {3635 rootHeadContainers = _.pluck( rootNodes, 'headContainer' ); 3636 appendContainer = $( '#customize-theme-controls .customize-pane-parent' ); // @todo This should be defined elsewhere, and to be configurable 3637 if ( ! api.utils.areElementListsEqual( rootHeadContainers, appendContainer.children() ) ) { 3586 3638 _( rootNodes ).each( function ( rootNode ) { 3587 appendContainer.append( rootNode. container );3639 appendContainer.append( rootNode.headContainer ); 3588 3640 } ); 3589 3641 wasReflowed = true; 3590 3642 } -
src/wp-admin/js/customize-nav-menus.js
diff --git a/src/wp-admin/js/customize-nav-menus.js b/src/wp-admin/js/customize-nav-menus.js index e514a0a..2865ef0 100644
a b 834 834 835 835 api.bind( 'pane-contents-reflowed', function() { 836 836 // Skip menus that have been removed. 837 if ( ! section.cont ainer.parent().length ) {837 if ( ! section.contentContainer.parent().length ) { 838 838 return; 839 839 } 840 840 section.container.find( '.menu-item .menu-item-reorder-nav button' ).attr({ 'tabindex': '0', 'aria-hidden': 'false' }); … … 952 952 var section = this; 953 953 954 954 if ( expanded ) { 955 wpNavMenu.menuList = section.cont ainer.find( '.accordion-section-content:first' );955 wpNavMenu.menuList = section.contentContainer; 956 956 wpNavMenu.targetList = wpNavMenu.menuList; 957 957 958 958 // Add attributes needed by wpNavMenu … … 1014 1014 onChangeExpanded: function( expanded ) { 1015 1015 var section = this, 1016 1016 button = section.container.find( '.add-menu-toggle' ), 1017 content = section.cont ainer.find( '.new-menu-section-content' ),1018 customizer = section. container.closest( '.wp-full-overlay-sidebar-content' );1017 content = section.contentContainer, 1018 customizer = section.headContainer.closest( '.wp-full-overlay-sidebar-content' ); 1019 1019 if ( expanded ) { 1020 1020 button.addClass( 'open' ); 1021 1021 button.attr( 'aria-expanded', 'true' ); … … 1028 1028 content.slideUp( 'fast' ); 1029 1029 content.find( '.menu-name-field' ).removeClass( 'invalid' ); 1030 1030 } 1031 }, 1032 1033 /** 1034 * Detach and return the content html, extracted from the container html, if it exists. 1035 * 1036 * @since 4.7.0 1037 * 1038 * @returns {jQuery} Content UL element. 1039 */ 1040 _getContent: function () { 1041 return this.container.find( 'ul:first' ); 1031 1042 } 1032 1043 }); 1033 1044 … … 1984 1995 */ 1985 1996 ready: function() { 1986 1997 var control = this, 1998 section = api.section( control.section() ), 1987 1999 menuId = control.params.menu_id, 1988 2000 menu = control.setting(), 1989 2001 name, … … 2000 2012 * being deactivated. 2001 2013 */ 2002 2014 control.active.validate = function() { 2003 var value , section = api.section( control.section() );2015 var value; 2004 2016 if ( section ) { 2005 2017 value = section.active(); 2006 2018 } else { … … 2009 2021 return value; 2010 2022 }; 2011 2023 2012 control.$controlSection = control.container.closest( '.control-section' );2024 control.$controlSection = section.headContainer; 2013 2025 control.$sectionContent = control.container.closest( '.accordion-section-content' ); 2014 2026 2015 2027 this._setupModel(); … … 2283 2295 return; 2284 2296 } 2285 2297 2286 var section = control.container.closest( '.accordion-section'),2298 var section = api.section( control.section() ), 2287 2299 menuId = control.params.menu_id, 2288 controlTitle = section. find( '.accordion-section-title' ),2289 sectionTitle = section. find( '.customize-section-title h3' ),2290 location = section. find( '.menu-in-location' ),2300 controlTitle = section.headContainer.find( '.accordion-section-title' ), 2301 sectionTitle = section.contentContainer.find( '.customize-section-title h3' ), 2302 location = section.headContainer.find( '.menu-in-location' ), 2291 2303 action = sectionTitle.find( '.customize-action' ), 2292 2304 name = displayNavMenuName( menu.name ); 2293 2305 … … 2311 2323 } ); 2312 2324 2313 2325 // Update the nav menu name in all location checkboxes. 2314 section. find( '.customize-control-checkbox input' ).each( function() {2326 section.contentContainer.find( '.customize-control-checkbox input' ).each( function() { 2315 2327 if ( $( this ).prop( 'checked' ) ) { 2316 2328 $( '.current-menu-location-name-' + $( this ).data( 'location-id' ) ).text( name ); 2317 2329 } … … 2625 2637 2626 2638 // Focus on the new menu section. 2627 2639 api.section( customizeId ).focus(); // @todo should we focus on the new menu's control and open the add-items panel? Thinking user flow... 2628 2629 // Fix an issue with extra space at top immediately after creating new menu.2630 $( '#menu-to-edit' ).css( 'margin-top', 0 );2631 2640 } 2632 2641 }); 2633 2642 -
tests/qunit/wp-admin/js/customize-controls.js
diff --git a/tests/qunit/wp-admin/js/customize-controls.js b/tests/qunit/wp-admin/js/customize-controls.js index d806e46..e39b571 100644
a b jQuery( window ).load( function (){ 211 211 section = wp.customize.section( id ); 212 212 ok( ! section.params.content ); 213 213 ok( !! section.container ); 214 ok( section.container.is( '.control-section.control-section-default' ) ); 215 ok( 1 === section.container.find( '> .accordion-section-title' ).length ); 216 ok( 1 === section.container.find( '> .accordion-section-content' ).length ); 214 ok( !! section.headContainer ); 215 ok( !! section.contentContainer ); 216 ok( section.container.has( section.headContainer ) ); 217 ok( section.container.has( section.contentContainer ) ); 218 ok( section.headContainer.is( '.control-section.control-section-default' ) ); 219 ok( 1 === section.headContainer.find( '> .accordion-section-title' ).length ); 220 ok( section.contentContainer.is( '.accordion-section-content' ) ); 221 equal( section.headContainer.attr( 'aria-owns' ), section.contentContainer.attr( 'id' ) ); 217 222 } ); 218 223 219 224 module( 'Customizer Custom Type (titleless) Section with Template in Fixture' ); … … jQuery( window ).load( function (){ 225 230 section = wp.customize.section( id ); 226 231 ok( ! section.params.content ); 227 232 ok( !! section.container ); 233 ok( !! section.headContainer ); 234 ok( !! section.contentContainer ); 235 ok( section.container.has( section.headContainer ) ); 236 ok( section.container.has( section.contentContainer ) ); 228 237 ok( section.container.is( '.control-section.control-section-titleless' ) ); 229 ok( 0 === section.container.find( '> .accordion-section-title' ).length ); 230 ok( 1 === section.container.find( '> .accordion-section-content' ).length ); 238 ok( 0 === section.headContainer.find( '> .accordion-section-title' ).length ); 239 ok( section.contentContainer.is( '.accordion-section-content' ) ); 240 equal( section.headContainer.attr( 'aria-owns' ), section.contentContainer.attr( 'id' ) ); 231 241 } ); 232 242 module( 'Customizer Custom Type Section Lacking Specific Template' ); 233 243 test( 'Fixture section has expected content', function () { … … jQuery( window ).load( function (){ 235 245 section = wp.customize.section( id ); 236 246 ok( ! section.params.content ); 237 247 ok( !! section.container ); 238 ok( section.container.is( '.control-section.control-section-' + section.params.type ) ); 239 ok( 1 === section.container.find( '> .accordion-section-title' ).length ); 240 ok( 1 === section.container.find( '> .accordion-section-content' ).length ); 248 ok( !! section.headContainer ); 249 ok( !! section.contentContainer ); 250 ok( section.container.has( section.headContainer ) ); 251 ok( section.container.has( section.contentContainer ) ); 252 ok( section.headContainer.is( '.control-section.control-section-' + section.params.type ) ); 253 ok( 1 === section.headContainer.find( '> .accordion-section-title' ).length ); 254 ok( section.contentContainer.is( '.accordion-section-content' ) ); 255 equal( section.headContainer.attr( 'aria-owns' ), section.contentContainer.attr( 'id' ) ); 241 256 } ); 242 257 module( 'Customizer Section lacking any params' ); 243 258 test( 'Fixture section has default params supplied', function () { … … jQuery( window ).load( function (){ 270 285 var panel = wp.customize.panel( 'fixture-panel' ); 271 286 ok( !! panel.params.content ); 272 287 ok( !! panel.container ); 288 ok( !! panel.headContainer ); 289 ok( !! panel.contentContainer ); 290 ok( panel.container.has( panel.headContainer ) ); 291 ok( panel.container.has( panel.contentContainer ) ); 273 292 } ); 274 293 test( 'Fixture panel has section among its sections()', function () { 275 294 var panel = wp.customize.panel( 'fixture-panel' ); … … jQuery( window ).load( function (){ 304 323 panel = wp.customize.panel( id ); 305 324 ok( ! panel.params.content ); 306 325 ok( !! panel.container ); 307 ok( panel.container.is( '.control-panel.control-panel-default' ) ); 308 ok( 1 === panel.container.find( '> .accordion-section-title' ).length ); 309 ok( 1 === panel.container.find( '> .control-panel-content' ).length ); 326 ok( !! panel.headContainer ); 327 ok( !! panel.contentContainer ); 328 ok( panel.container.has( panel.headContainer ) ); 329 ok( panel.container.has( panel.contentContainer ) ); 330 ok( panel.headContainer.is( '.control-panel.control-panel-default' ) ); 331 ok( 1 === panel.headContainer.find( '> .accordion-section-title' ).length ); 332 ok( panel.contentContainer.is( '.control-panel-content' ) ); 333 equal( panel.headContainer.attr( 'aria-owns' ), panel.contentContainer.attr( 'id' ) ); 310 334 } ); 311 335 312 336 module( 'Customizer Custom Type Panel (titleless) with Template in Fixture' ); … … jQuery( window ).load( function (){ 318 342 panel = wp.customize.panel( id ); 319 343 ok( ! panel.params.content ); 320 344 ok( !! panel.container ); 321 ok( panel.container.is( '.control-panel.control-panel-titleless' ) ); 322 ok( 0 === panel.container.find( '> .accordion-section-title' ).length ); 323 ok( 1 === panel.container.find( '> .control-panel-content' ).length ); 345 ok( !! panel.headContainer ); 346 ok( !! panel.contentContainer ); 347 ok( panel.container.has( panel.headContainer ) ); 348 ok( panel.container.has( panel.contentContainer ) ); 349 ok( panel.headContainer.is( '.control-panel.control-panel-titleless' ) ); 350 ok( 0 === panel.headContainer.find( '> .accordion-section-title' ).length ); 351 ok( panel.contentContainer.is( '.control-panel-content' ) ); 352 equal( panel.headContainer.attr( 'aria-owns' ), panel.contentContainer.attr( 'id' ) ); 324 353 } ); 325 354 326 355 module( 'Customizer Custom Type Panel Lacking Specific Template' ); … … jQuery( window ).load( function (){ 329 358 panel = wp.customize.panel( id ); 330 359 ok( ! panel.params.content ); 331 360 ok( !! panel.container ); 332 ok( panel.container.is( '.control-panel.control-panel-' + panel.params.type ) ); 333 ok( 1 === panel.container.find( '> .accordion-section-title' ).length ); 334 ok( 1 === panel.container.find( '> .control-panel-content' ).length ); 361 ok( !! panel.headContainer ); 362 ok( !! panel.contentContainer ); 363 ok( panel.container.has( panel.headContainer ) ); 364 ok( panel.container.has( panel.contentContainer ) ); 365 ok( panel.headContainer.is( '.control-panel.control-panel-' + panel.params.type ) ); 366 ok( 1 === panel.headContainer.find( '> .accordion-section-title' ).length ); 367 ok( panel.contentContainer.is( '.control-panel-content' ) ); 368 equal( panel.headContainer.attr( 'aria-owns' ), panel.contentContainer.attr( 'id' ) ); 335 369 } ); 336 370 module( 'Customizer Panel lacking any params' ); 337 371 test( 'Fixture panel has default params supplied', function () { -
tests/qunit/wp-admin/js/customize-widgets.js
diff --git a/tests/qunit/wp-admin/js/customize-widgets.js b/tests/qunit/wp-admin/js/customize-widgets.js index 225d155..5f754a4 100644
a b jQuery( window ).load( function() { 58 58 ok( panel.extended( api.Widgets.WidgetsPanel ) ); 59 59 60 60 panel.deferred.embedded.done( function() { 61 ok( 1 === panel.cont ainer.find( '.no-widget-areas-rendered-notice' ).length );62 ok( panel.cont ainer.find( '.no-widget-areas-rendered-notice' ).is( ':visible' ) );61 ok( 1 === panel.contentContainer.find( '.no-widget-areas-rendered-notice' ).length ); 62 ok( panel.contentContainer.find( '.no-widget-areas-rendered-notice' ).is( ':visible' ) ); 63 63 api.section( 'sidebar-widgets-sidebar-1' ).active( true ); 64 64 api.control( 'sidebars_widgets[sidebar-1]' ).active( true ); 65 65 api.trigger( 'pane-contents-reflowed' ); 66 ok( ! panel.cont ainer.find( '.no-widget-areas-rendered-notice' ).is( ':visible' ) );66 ok( ! panel.contentContainer.find( '.no-widget-areas-rendered-notice' ).is( ':visible' ) ); 67 67 } ); 68 68 69 69 expect( 4 );