From 6406fb561abbbfe399e10c3864dc1954cdca445b Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Mon, 11 Sep 2017 05:22:22 +0000 Subject: [PATCH] Customize: Add rightward-facing back button to Themes section header to improve navigation (since the section slides in from the left). Also serves to prototype for an upward-facing arrow in this location for a Publish Settings section. Props melchoyce, westonruter. See #39896, #40278, #21666. git-svn-id: https://develop.svn.wordpress.org/trunk@41368 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/css/customize-controls.css | 15 +++++++++++++++ src/wp-admin/js/customize-controls.js | 9 +++++++++ .../class-wp-customize-themes-section.php | 1 + 3 files changed, 25 insertions(+) diff --git a/src/wp-admin/css/customize-controls.css b/src/wp-admin/css/customize-controls.css index 3ec8f2f9d3..eaaee146c4 100644 --- a/src/wp-admin/css/customize-controls.css +++ b/src/wp-admin/css/customize-controls.css @@ -1168,6 +1168,21 @@ p.customize-section-description { border-left: none; margin-top: 0; } +#customize-theme-controls .control-section-themes .customize-section-back { + position: absolute; + right: 0; + top: 0; + height: 80px; + border-left: 1px solid #ddd; + border-right: 4px solid #fff; +} +#customize-theme-controls .control-section-themes .customize-section-back:before { + content: "\f345"; +} +#customize-theme-controls .control-section-themes .customize-section-back:hover, +#customize-theme-controls .control-section-themes .customize-section-back:focus { + border-right-color: #0073aa; +} #customize-theme-controls .control-section-themes .customize-themes-panel .accordion-section-title:first-child:hover, /* Not a focusable element. */ #customize-theme-controls .control-section-themes .customize-themes-panel .accordion-section-title:first-child { diff --git a/src/wp-admin/js/customize-controls.js b/src/wp-admin/js/customize-controls.js index af93b06ce5..518b10996d 100644 --- a/src/wp-admin/js/customize-controls.js +++ b/src/wp-admin/js/customize-controls.js @@ -1164,6 +1164,15 @@ attachEvents: function () { var section = this; + // Expand/Collapse accordion sections on click. + section.container.find( '.customize-section-back' ).on( 'click keydown', function( event ) { + if ( api.utils.isKeydownButNotEnterEvent( event ) ) { + return; + } + event.preventDefault(); // Keep this AFTER the key filter above + section.collapse(); + }); + // Expand/Collapse section/panel. section.container.find( '.change-theme, .customize-theme' ).on( 'click keydown', function( event ) { if ( api.utils.isKeydownButNotEnterEvent( event ) ) { diff --git a/src/wp-includes/customize/class-wp-customize-themes-section.php b/src/wp-includes/customize/class-wp-customize-themes-section.php index 72175a836f..415ef47222 100644 --- a/src/wp-includes/customize/class-wp-customize-themes-section.php +++ b/src/wp-includes/customize/class-wp-customize-themes-section.php @@ -50,6 +50,7 @@ class WP_Customize_Themes_Section extends WP_Customize_Section {

+ controls ) + 1 /* Active theme */; ?>