<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[24734] trunk/wp-admin: Fixes and tweaks for the metabox accordion.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/24734">24734</a></dd>
<dt>Author</dt> <dd>markjaquith</dd>
<dt>Date</dt> <dd>2013-07-18 17:42:53 +0000 (Thu, 18 Jul 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>Fixes and tweaks for the metabox accordion.

* Fixed hover issues in Customizer.
* Toned down the default active/hover style (as it is normally not the top level menu, and should not be so prominent).
* Allow the active section to be closed.
* Other misc fixes.

Props ocean90, helen. Fixes <a href="http://core.trac.wordpress.org/ticket/23449">#23449</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadmincsscustomizecontrolscss">trunk/wp-admin/css/customize-controls.css</a></li>
<li><a href="#trunkwpadmincsswpadmincss">trunk/wp-admin/css/wp-admin.css</a></li>
<li><a href="#trunkwpadmincustomizephp">trunk/wp-admin/customize.php</a></li>
<li><a href="#trunkwpadminincludestemplatephp">trunk/wp-admin/includes/template.php</a></li>
<li><a href="#trunkwpadminjsaccordionjs">trunk/wp-admin/js/accordion.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadmincsscustomizecontrolscss"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/css/customize-controls.css (24733 => 24734)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/css/customize-controls.css        2013-07-18 16:58:54 UTC (rev 24733)
+++ trunk/wp-admin/css/customize-controls.css   2013-07-18 17:42:53 UTC (rev 24734)
</span><span class="lines">@@ -121,6 +121,36 @@
</span><span class="cx">  height: 100%;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#customize-theme-controls .accordion-section-title:hover:after,
+#customize-theme-controls .accordion-section-title:focus:after {
+       border-color: #eee transparent;
+}
+
+#customize-theme-controls .control-section:hover .accordion-section-title,
+#customize-theme-controls .control-section .accordion-section-title:hover,
+#customize-theme-controls .control-section.open .accordion-section-title,
+#customize-theme-controls .control-section .accordion-section-title:focus {
+       color: #fff;
+       text-shadow: 0 -1px 0 #333;
+       background: #808080;
+       background-image: -webkit-gradient(linear, left bottom, left top, from(#6d6d6d), to(#808080));
+       background-image: -webkit-linear-gradient(bottom, #6d6d6d, #808080);
+       background-image:    -moz-linear-gradient(bottom, #6d6d6d, #808080);
+       background-image:      -o-linear-gradient(bottom, #6d6d6d, #808080);
+       background-image: linear-gradient(to top, #6d6d6d, #808080);
+       border-left: 1px solid #808080;
+       border-right: 1px solid #808080;
+}
+
+#customize-theme-controls .control-section.accordion-section:hover,
+#customize-theme-controls .control-section.accordion-section.open {
+       border-top-color: #808080;
+}
+
+#customize-theme-controls .control-section.open .accordion-section-title {
+       border-bottom: 1px solid #6d6d6d;
+}
+
</ins><span class="cx"> /*
</span><span class="cx">  * Style for custom settings
</span><span class="cx">  */
</span></span></pre></div>
<a id="trunkwpadmincsswpadmincss"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/css/wp-admin.css (24733 => 24734)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/css/wp-admin.css  2013-07-18 16:58:54 UTC (rev 24733)
+++ trunk/wp-admin/css/wp-admin.css     2013-07-18 17:42:53 UTC (rev 24734)
</span><span class="lines">@@ -9047,6 +9047,7 @@
</span><span class="cx"> 
</span><span class="cx"> .control-section .accordion-section-title {
</span><span class="cx">  padding: 10px 20px;
</span><ins>+       color: #464646;
</ins><span class="cx">   font-size: 15px;
</span><span class="cx">  font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
</span><span class="cx">  font-weight: normal;
</span><span class="lines">@@ -9063,34 +9064,21 @@
</span><span class="cx">  top: 15px;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-.control-section .accordion-section-title:hover:after,
-.control-section .accordion-section-title:focus:after {
-       border-color: #eee transparent;
-}
-
</del><span class="cx"> .js .control-section:hover .accordion-section-title,
</span><span class="cx"> .js .control-section .accordion-section-title:hover,
</span><span class="cx"> .js .control-section.open .accordion-section-title,
</span><span class="cx"> .js .control-section .accordion-section-title:focus {
</span><del>-       color: #fff;
-       text-shadow: 0 -1px 0 #333;
-       background: #808080;
-       background-image: -webkit-gradient(linear, left bottom, left top, from(#6d6d6d), to(#808080));
-       background-image: -webkit-linear-gradient(bottom, #6d6d6d, #808080);
-       background-image:    -moz-linear-gradient(bottom, #6d6d6d, #808080);
-       background-image:      -o-linear-gradient(bottom, #6d6d6d, #808080);
-       background-image: linear-gradient(to top, #6d6d6d, #808080);
-       border-left: 1px solid #808080;
-       border-right: 1px solid #808080;
</del><ins>+        color: #000;
+       background: #f9f9f9;
+       background-image: -webkit-gradient(linear, left bottom, left top, from(#ececec), to(#f9f9f9));
+       background-image: -webkit-linear-gradient(bottom, #ececec, #f9f9f9);
+       background-image:    -moz-linear-gradient(bottom, #ececec, #f9f9f9);
+       background-image:      -o-linear-gradient(bottom, #ececec, #f9f9f9);
+       background-image: linear-gradient(to top, #ececec, #f9f9f9);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-.js .control-section.accordion-section:hover,
-.control-section.accordion-section.open {
-       border-top-color: #808080;
-}
-
</del><span class="cx"> .control-section.open .accordion-section-title {
</span><del>-       border-bottom: 1px solid #6d6d6d;
</del><ins>+        border-bottom: 1px solid #dfdfdf;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /* =Media Queries
</span></span></pre></div>
<a id="trunkwpadmincustomizephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/customize.php (24733 => 24734)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/customize.php     2013-07-18 16:58:54 UTC (rev 24733)
+++ trunk/wp-admin/customize.php        2013-07-18 17:42:53 UTC (rev 24734)
</span><span class="lines">@@ -46,7 +46,7 @@
</span><span class="cx"> wp_user_settings();
</span><span class="cx"> _wp_admin_html_begin();
</span><span class="cx"> 
</span><del>-$body_class = 'wp-core-ui';
</del><ins>+$body_class = 'wp-core-ui js';
</ins><span class="cx"> 
</span><span class="cx"> if ( wp_is_mobile() ) :
</span><span class="cx">  $body_class .= ' mobile';
</span><span class="lines">@@ -90,8 +90,8 @@
</span><span class="cx">                  $cannot_expand = ! ( $screenshot || $wp_customize->theme()->get('Description') );
</span><span class="cx">          ?>
</span><span class="cx"> 
</span><del>-               <div class="wp-full-overlay-sidebar-content" tabindex="-1">
-                       <div id="customize-info" class="accordion-section<?php if ( $cannot_expand ) echo ' cannot-expand'; ?>">
</del><ins>+                <div class="wp-full-overlay-sidebar-content accordion-container" tabindex="-1">
+                       <div id="customize-info" class="accordion-section <?php if ( $cannot_expand ) echo ' cannot-expand'; ?>">
</ins><span class="cx">                           <div class="accordion-section-title" aria-label="<?php esc_attr_e( 'Theme Customizer Options' ); ?>" tabindex="0">
</span><span class="cx">                                  <span class="preview-notice"><?php
</span><span class="cx">                                          /* translators: %s is the theme name in the Customize/Live Preview pane */
</span><span class="lines">@@ -111,7 +111,7 @@
</span><span class="cx">                          <?php endif; ?>
</span><span class="cx">                  </div>
</span><span class="cx"> 
</span><del>-                       <div id="customize-theme-controls" class="accordion-container"><ul>
</del><ins>+                        <div id="customize-theme-controls"><ul>
</ins><span class="cx">                           <?php
</span><span class="cx">                          foreach ( $wp_customize->sections() as $section )
</span><span class="cx">                                  $section->maybe_render();
</span></span></pre></div>
<a id="trunkwpadminincludestemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/template.php (24733 => 24734)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/template.php     2013-07-18 16:58:54 UTC (rev 24733)
+++ trunk/wp-admin/includes/template.php        2013-07-18 17:42:53 UTC (rev 24734)
</span><span class="lines">@@ -1000,6 +1000,7 @@
</span><span class="cx">          <ul class="outer-border">
</span><span class="cx">  <?php
</span><span class="cx">  $i = 0;
</span><ins>+       $first_open = false;
</ins><span class="cx">   do {
</span><span class="cx">          if ( ! isset( $wp_meta_boxes ) || ! isset( $wp_meta_boxes[$page] ) || ! isset( $wp_meta_boxes[$page][$context] ) )
</span><span class="cx">                  break;
</span><span class="lines">@@ -1011,8 +1012,14 @@
</span><span class="cx">                                          continue;
</span><span class="cx">                                  $i++;
</span><span class="cx">                                  $hidden_class = in_array( $box['id'], $hidden ) ? 'hide-if-js' : '';
</span><ins>+
+                                       $open_class = '';
+                                       if ( ! $first_open && empty( $hidden_class ) ) {
+                                               $first_open = true;
+                                               $open_class = 'open';
+                                       }
</ins><span class="cx">                                   ?>
</span><del>-                                       <li class="control-section accordion-section <?php echo $hidden_class; ?> <?php echo esc_attr( $box['id'] ); ?>" id="<?php echo esc_attr( $box['id'] ); ?>">
</del><ins>+                                        <li class="control-section accordion-section <?php echo $hidden_class; ?> <?php echo $open_class; ?> <?php echo esc_attr( $box['id'] ); ?>" id="<?php echo esc_attr( $box['id'] ); ?>">
</ins><span class="cx">                                           <h3 class="accordion-section-title hndle" tabindex="0" title="<?php echo esc_attr( $box['title'] ); ?>"><?php echo esc_html( $box['title'] ); ?></h3>
</span><span class="cx">                                          <div class="accordion-section-content <?php postbox_classes( $box['id'], $page ); ?>">
</span><span class="cx">                                                  <div class="inside">
</span></span></pre></div>
<a id="trunkwpadminjsaccordionjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/accordion.js (24733 => 24734)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/accordion.js   2013-07-18 16:58:54 UTC (rev 24733)
+++ trunk/wp-admin/js/accordion.js      2013-07-18 17:42:53 UTC (rev 24734)
</span><span class="lines">@@ -9,10 +9,9 @@
</span><span class="cx">                  e.preventDefault(); // Keep this AFTER the key filter above
</span><span class="cx"> 
</span><span class="cx">                  accordionSwitch( $( this ) );
</span><del>-                       accordionCorners();
</del><span class="cx">           });
</span><span class="cx"> 
</span><del>-               // Refresh selected accordion option when screen options are toggled
</del><ins>+                // Re-initialize accordion when screen options are toggled
</ins><span class="cx">           $( '.hide-postbox-tog' ).click( function () {
</span><span class="cx">                  accordionInit();
</span><span class="cx">          });
</span><span class="lines">@@ -22,33 +21,35 @@
</span><span class="cx">  var accordionOptions = $( '.accordion-container li.accordion-section' ),
</span><span class="cx">          sectionContent   = $( '.accordion-section-content' );
</span><span class="cx"> 
</span><del>-       // Rounded corners
-       function accordionCorners () {
</del><ins>+        function accordionInit () {
+               // Rounded corners
</ins><span class="cx">           accordionOptions.removeClass( 'top bottom' );
</span><span class="cx">          accordionOptions.filter( ':visible' ).first().addClass( 'top' );
</span><del>-               accordionOptions.filter( ':visible' ).last().addClass( 'bottom' ).find( sectionContent ).addClass('bottom');
-       };
-
-       function accordionInit () {
-               accordionSwitch( accordionOptions.filter( ':visible' ).first() );
-               accordionCorners();
</del><ins>+                accordionOptions.filter( ':visible' ).last().addClass( 'bottom' ).find( sectionContent ).addClass( 'bottom' );
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx">  function accordionSwitch ( el ) {
</span><span class="cx">          var section = el.closest( '.accordion-section' ),
</span><del>-                   siblings = section.parent().find( '.open' ),
-                   content = section.find( sectionContent );
</del><ins>+                        siblings = section.closest( '.accordion-container' ).find( '.open' ),
+                       content = section.find( sectionContent );
</ins><span class="cx"> 
</span><span class="cx">          if ( section.hasClass( 'cannot-expand' ) )
</span><span class="cx">                  return;
</span><span class="cx"> 
</span><del>-               siblings.removeClass( 'open' );
-               siblings.find( sectionContent ).show().slideUp( 150 );
-               content.toggle( section.hasClass( 'open' ) ).slideToggle( 150 );
-               section.toggleClass( 'open' );
</del><ins>+                if ( section.hasClass( 'open' ) ) {
+                       section.toggleClass( 'open' );
+                       content.toggle( true ).slideToggle( 150 );
+               } else {
+                       siblings.removeClass( 'open' );
+                       siblings.find( sectionContent ).show().slideUp( 150 );
+                       content.toggle( false ).slideToggle( 150 );
+                       section.toggleClass( 'open' );
+               }
+
+               accordionInit();
</ins><span class="cx">   }
</span><span class="cx"> 
</span><del>-       // Show the first accordion option by default
</del><ins>+        // Initialize the accordion (currently just corner fixes)
</ins><span class="cx">   accordionInit();
</span><span class="cx"> 
</span><span class="cx"> })(jQuery);
</span></span></pre>
</div>
</div>

</body>
</html>