From 8894171c45766b8d733b8f8421094ad50f635974 Mon Sep 17 00:00:00 2001
From: Ryan Kienstra <ryan.kienstra@xwp.co>
Date: Fri, 4 Mar 2016 01:48:11 -0300
Subject: [PATCH 1/6] Customize : Remove extra space at bottom of Customizer
panel.
Before, non-active sections and panels still occupied space in the DOM.
So the active panel had a 'margin-top' property to move it to the top.
So set the height of the non-active sections to 0.
And don't add a margin-top value to the active panel's content.
Fixes #35947.
---
src/wp-admin/css/customize-controls.css | 8 ++++++++
src/wp-admin/js/customize-controls.js | 1 -
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/wp-admin/css/customize-controls.css b/src/wp-admin/css/customize-controls.css
index 82132e3..32d5827 100644
|
a
|
b
|
h3.customize-section-title {
|
| 430 | 430 | width: 300px; |
| 431 | 431 | } |
| 432 | 432 | |
| | 433 | .in-sub-panel #customize-info { |
| | 434 | height: 0; |
| | 435 | } |
| | 436 | |
| | 437 | .in-sub-panel #customize-theme-controls > ul > .control-section:not(.current-panel) { |
| | 438 | height: 0; |
| | 439 | } |
| | 440 | |
| 433 | 441 | .in-sub-panel #customize-theme-controls .accordion-section.current-panel { |
| 434 | 442 | width: 100%; |
| 435 | 443 | } |
diff --git a/src/wp-admin/js/customize-controls.js b/src/wp-admin/js/customize-controls.js
index 8fcf08b..1c1acfd 100644
|
a
|
b
|
|
| 1363 | 1363 | content.parent().show(); |
| 1364 | 1364 | position = content.offset().top; |
| 1365 | 1365 | scroll = container.scrollTop(); |
| 1366 | | content.css( 'margin-top', ( headerActionsHeight - position - scroll ) ); |
| 1367 | 1366 | accordionSection.addClass( 'current-panel' ); |
| 1368 | 1367 | overlay.addClass( 'in-sub-panel' ); |
| 1369 | 1368 | container.scrollTop( 0 ); |
From 200b497d271bedc324f21262465487210164433e Mon Sep 17 00:00:00 2001
From: Ryan Kienstra <ryan.kienstra@xwp.co>
Date: Fri, 4 Mar 2016 02:16:23 -0300
Subject: [PATCH 2/6] Customize : Remove variables that were deleted in commit
8894171.
These are no longer used in the function in which they're defined.
They were deleted as part of a commit to remove the 'margin-top' value.
Fixes #35947.
---
src/wp-admin/js/customize-controls.js | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/src/wp-admin/js/customize-controls.js b/src/wp-admin/js/customize-controls.js
index 1c1acfd..086472b 100644
|
a
|
b
|
|
| 1333 | 1333 | } |
| 1334 | 1334 | |
| 1335 | 1335 | // Note: there is a second argument 'args' passed |
| 1336 | | var position, scroll, |
| 1337 | | panel = this, |
| | 1336 | var panel = this, |
| 1338 | 1337 | accordionSection = panel.container.closest( '.accordion-section' ), |
| 1339 | 1338 | overlay = accordionSection.closest( '.wp-full-overlay' ), |
| 1340 | 1339 | container = accordionSection.closest( '.wp-full-overlay-sidebar-content' ), |
| … |
… |
|
| 1342 | 1341 | topPanel = overlay.find( '#customize-theme-controls > ul > .accordion-section > .accordion-section-title' ), |
| 1343 | 1342 | backBtn = accordionSection.find( '.customize-panel-back' ), |
| 1344 | 1343 | panelTitle = accordionSection.find( '.accordion-section-title' ).first(), |
| 1345 | | content = accordionSection.find( '.control-panel-content' ), |
| 1346 | | headerActionsHeight = $( '#customize-header-actions' ).height(); |
| | 1344 | content = accordionSection.find( '.control-panel-content' ); |
| 1347 | 1345 | |
| 1348 | 1346 | if ( expanded ) { |
| 1349 | 1347 | |
| … |
… |
|
| 1361 | 1359 | |
| 1362 | 1360 | content.show( 0, function() { |
| 1363 | 1361 | content.parent().show(); |
| 1364 | | position = content.offset().top; |
| 1365 | | scroll = container.scrollTop(); |
| 1366 | 1362 | accordionSection.addClass( 'current-panel' ); |
| 1367 | 1363 | overlay.addClass( 'in-sub-panel' ); |
| 1368 | 1364 | container.scrollTop( 0 ); |
From c00e5eaf37284881a363aecefcc4b06e636ca1ba Mon Sep 17 00:00:00 2001
From: Ryan Kienstra <ryan.kienstra@xwp.co>
Date: Sat, 5 Mar 2016 01:00:12 -0300
Subject: [PATCH 3/6] Fix issue with widget's contents being too high on
clicking in preview.
When clicking a widget in the preview, the 'onChangeExpanded' method is called.
This included a jQuery method that adds a 'margin-top' value.
Remove this method call, as it caused a spacing issue.
The inactive panels no longer occupy space, from commit 8894171c.
So there's no adjustment needed for the controls to appear properly.
Fixes #34747.
---
src/wp-admin/js/customize-controls.js | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/src/wp-admin/js/customize-controls.js b/src/wp-admin/js/customize-controls.js
index 086472b..7fd2b54 100644
|
a
|
b
|
|
| 648 | 648 | overlay = section.container.closest( '.wp-full-overlay' ), |
| 649 | 649 | backBtn = section.container.find( '.customize-section-back' ), |
| 650 | 650 | sectionTitle = section.container.find( '.accordion-section-title' ).first(), |
| 651 | | headerActionsHeight = $( '#customize-header-actions' ).height(), |
| 652 | | resizeContentHeight, expand, position, scroll; |
| | 651 | resizeContentHeight, expand; |
| 653 | 652 | |
| 654 | 653 | if ( expanded && ! section.container.hasClass( 'open' ) ) { |
| 655 | 654 | |
| … |
… |
|
| 671 | 670 | expand = function() { |
| 672 | 671 | section.container.addClass( 'open' ); |
| 673 | 672 | overlay.addClass( 'section-open' ); |
| 674 | | position = content.offset().top; |
| 675 | | scroll = container.scrollTop(); |
| 676 | | content.css( 'margin-top', ( headerActionsHeight - position - scroll ) ); |
| 677 | 673 | resizeContentHeight(); |
| 678 | 674 | sectionTitle.attr( 'tabindex', '-1' ); |
| 679 | 675 | backBtn.attr( 'tabindex', '0' ); |
From 334473cb0975541e7b46935caa50061ec235fd45 Mon Sep 17 00:00:00 2001
From: Piotr Delawski <piotr.delawski@xwp.co>
Date: Sat, 5 Mar 2016 16:44:44 +0100
Subject: [PATCH 4/6] Remove horizontal gap next to scrollbar when opening a
panel (reverts previous changes by @kienstra).
---
src/wp-admin/css/customize-controls.css | 8 --------
src/wp-admin/js/customize-controls.js | 27 ++++++++++++++++++---------
2 files changed, 18 insertions(+), 17 deletions(-)
diff --git a/src/wp-admin/css/customize-controls.css b/src/wp-admin/css/customize-controls.css
index 32d5827..82132e3 100644
|
a
|
b
|
h3.customize-section-title {
|
| 430 | 430 | width: 300px; |
| 431 | 431 | } |
| 432 | 432 | |
| 433 | | .in-sub-panel #customize-info { |
| 434 | | height: 0; |
| 435 | | } |
| 436 | | |
| 437 | | .in-sub-panel #customize-theme-controls > ul > .control-section:not(.current-panel) { |
| 438 | | height: 0; |
| 439 | | } |
| 440 | | |
| 441 | 433 | .in-sub-panel #customize-theme-controls .accordion-section.current-panel { |
| 442 | 434 | width: 100%; |
| 443 | 435 | } |
diff --git a/src/wp-admin/js/customize-controls.js b/src/wp-admin/js/customize-controls.js
index 7fd2b54..3a89bb7 100644
|
a
|
b
|
|
| 1329 | 1329 | } |
| 1330 | 1330 | |
| 1331 | 1331 | // Note: there is a second argument 'args' passed |
| 1332 | | var panel = this, |
| | 1332 | var position, scroll, |
| | 1333 | panel = this, |
| 1333 | 1334 | accordionSection = panel.container.closest( '.accordion-section' ), |
| 1334 | 1335 | overlay = accordionSection.closest( '.wp-full-overlay' ), |
| 1335 | 1336 | container = accordionSection.closest( '.wp-full-overlay-sidebar-content' ), |
| … |
… |
|
| 1337 | 1338 | topPanel = overlay.find( '#customize-theme-controls > ul > .accordion-section > .accordion-section-title' ), |
| 1338 | 1339 | backBtn = accordionSection.find( '.customize-panel-back' ), |
| 1339 | 1340 | panelTitle = accordionSection.find( '.accordion-section-title' ).first(), |
| 1340 | | content = accordionSection.find( '.control-panel-content' ); |
| | 1341 | content = accordionSection.find( '.control-panel-content' ), |
| | 1342 | headerActionsHeight = $( '#customize-header-actions' ).height(); |
| 1341 | 1343 | |
| 1342 | 1344 | if ( expanded ) { |
| 1343 | 1345 | |
| … |
… |
|
| 1355 | 1357 | |
| 1356 | 1358 | content.show( 0, function() { |
| 1357 | 1359 | content.parent().show(); |
| | 1360 | position = content.offset().top; |
| | 1361 | scroll = container.scrollTop(); |
| | 1362 | content.css( 'margin-top', ( headerActionsHeight - position - scroll ) ); |
| 1358 | 1363 | accordionSection.addClass( 'current-panel' ); |
| 1359 | 1364 | overlay.addClass( 'in-sub-panel' ); |
| 1360 | 1365 | container.scrollTop( 0 ); |
| 1361 | | if ( args.completeCallback ) { |
| 1362 | | args.completeCallback(); |
| 1363 | | } |
| | 1366 | _.defer( function() { |
| | 1367 | panel._recalculateTopMargin(); |
| | 1368 | topPanel.attr( 'tabindex', '-1' ); |
| | 1369 | backBtn.attr( 'tabindex', '0' ); |
| | 1370 | }); |
| | 1371 | _.delay( function() { |
| | 1372 | backBtn.focus(); |
| | 1373 | if ( args.completeCallback ) { |
| | 1374 | args.completeCallback(); |
| | 1375 | } |
| | 1376 | }, 180 ); |
| 1364 | 1377 | } ); |
| 1365 | | topPanel.attr( 'tabindex', '-1' ); |
| 1366 | | backBtn.attr( 'tabindex', '0' ); |
| 1367 | | backBtn.focus(); |
| 1368 | | panel._recalculateTopMargin(); |
| 1369 | 1378 | } else { |
| 1370 | 1379 | siblings.removeClass( 'open' ); |
| 1371 | 1380 | accordionSection.removeClass( 'current-panel' ); |
From f0266c082fee227cf81c7d8c775e68449fe7102b Mon Sep 17 00:00:00 2001
From: Piotr Delawski <piotr.delawski@xwp.co>
Date: Sat, 5 Mar 2016 16:58:51 +0100
Subject: [PATCH 5/6] Revert c00e5ea and remove `_.defer` as it seems not be
needed now.
---
src/wp-admin/js/customize-controls.js | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/wp-admin/js/customize-controls.js b/src/wp-admin/js/customize-controls.js
index b945ce2..dbda12b 100644
|
a
|
b
|
|
| 648 | 648 | overlay = section.container.closest( '.wp-full-overlay' ), |
| 649 | 649 | backBtn = section.container.find( '.customize-section-back' ), |
| 650 | 650 | sectionTitle = section.container.find( '.accordion-section-title' ).first(), |
| 651 | | resizeContentHeight, expand; |
| | 651 | headerActionsHeight = $( '#customize-header-actions' ).height(), |
| | 652 | resizeContentHeight, expand, position, scroll; |
| 652 | 653 | |
| 653 | 654 | if ( expanded && ! section.container.hasClass( 'open' ) ) { |
| 654 | 655 | |
| … |
… |
|
| 670 | 671 | expand = function() { |
| 671 | 672 | section.container.addClass( 'open' ); |
| 672 | 673 | overlay.addClass( 'section-open' ); |
| | 674 | position = content.offset().top; |
| | 675 | scroll = container.scrollTop(); |
| | 676 | content.css( 'margin-top', ( headerActionsHeight - position - scroll ) ); |
| 673 | 677 | resizeContentHeight(); |
| 674 | 678 | sectionTitle.attr( 'tabindex', '-1' ); |
| 675 | 679 | backBtn.attr( 'tabindex', '0' ); |
| … |
… |
|
| 1363 | 1367 | accordionSection.addClass( 'current-panel' ); |
| 1364 | 1368 | overlay.addClass( 'in-sub-panel' ); |
| 1365 | 1369 | container.scrollTop( 0 ); |
| 1366 | | _.defer( function() { |
| 1367 | | panel._recalculateTopMargin(); |
| 1368 | | topPanel.attr( 'tabindex', '-1' ); |
| 1369 | | backBtn.attr( 'tabindex', '0' ); |
| 1370 | | }); |
| | 1370 | topPanel.attr( 'tabindex', '-1' ); |
| | 1371 | backBtn.attr( 'tabindex', '0' ); |
| | 1372 | panel._recalculateTopMargin(); |
| 1371 | 1373 | _.delay( function() { |
| 1372 | 1374 | backBtn.focus(); |
| 1373 | 1375 | if ( args.completeCallback ) { |
From 89591f9e3c3ae42b6b1c40b350f30c51c90892fa Mon Sep 17 00:00:00 2001
From: Piotr Delawski <piotr.delawski@xwp.co>
Date: Sun, 6 Mar 2016 22:44:00 +0100
Subject: [PATCH 6/6] Remove vertical gap below list of panels when there is a
lot of panels registered.
---
src/wp-admin/css/customize-controls.css | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/wp-admin/css/customize-controls.css b/src/wp-admin/css/customize-controls.css
index c3b6e01..84e29f3 100644
|
a
|
b
|
h3.customize-section-title {
|
| 428 | 428 | .in-sub-panel #customize-theme-controls > ul > .accordion-section { |
| 429 | 429 | left: -300px; |
| 430 | 430 | width: 300px; |
| | 431 | height: 0; |
| 431 | 432 | } |
| 432 | 433 | |
| 433 | 434 | .in-sub-panel #customize-theme-controls .accordion-section.current-panel { |
| 434 | 435 | width: 100%; |
| | 436 | height: auto; |
| 435 | 437 | } |
| 436 | 438 | |
| 437 | 439 | #customize-theme-controls .control-section.current-panel { |