Make WordPress Core

Changeset 24734


Ignore:
Timestamp:
07/18/2013 05:42:53 PM (11 years ago)
Author:
markjaquith
Message:

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 #23449.

Location:
trunk/wp-admin
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/css/customize-controls.css

    r23417 r24734  
    120120    width: 100%;
    121121    height: 100%;
     122}
     123
     124#customize-theme-controls .accordion-section-title:hover:after,
     125#customize-theme-controls .accordion-section-title:focus:after {
     126    border-color: #eee transparent;
     127}
     128
     129#customize-theme-controls .control-section:hover .accordion-section-title,
     130#customize-theme-controls .control-section .accordion-section-title:hover,
     131#customize-theme-controls .control-section.open .accordion-section-title,
     132#customize-theme-controls .control-section .accordion-section-title:focus {
     133    color: #fff;
     134    text-shadow: 0 -1px 0 #333;
     135    background: #808080;
     136    background-image: -webkit-gradient(linear, left bottom, left top, from(#6d6d6d), to(#808080));
     137    background-image: -webkit-linear-gradient(bottom, #6d6d6d, #808080);
     138    background-image:    -moz-linear-gradient(bottom, #6d6d6d, #808080);
     139    background-image:      -o-linear-gradient(bottom, #6d6d6d, #808080);
     140    background-image: linear-gradient(to top, #6d6d6d, #808080);
     141    border-left: 1px solid #808080;
     142    border-right: 1px solid #808080;
     143}
     144
     145#customize-theme-controls .control-section.accordion-section:hover,
     146#customize-theme-controls .control-section.accordion-section.open {
     147    border-top-color: #808080;
     148}
     149
     150#customize-theme-controls .control-section.open .accordion-section-title {
     151    border-bottom: 1px solid #6d6d6d;
    122152}
    123153
  • trunk/wp-admin/css/wp-admin.css

    r24732 r24734  
    90489048.control-section .accordion-section-title {
    90499049    padding: 10px 20px;
     9050    color: #464646;
    90509051    font-size: 15px;
    90519052    font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
     
    90649065}
    90659066
    9066 .control-section .accordion-section-title:hover:after,
    9067 .control-section .accordion-section-title:focus:after {
    9068     border-color: #eee transparent;
    9069 }
    9070 
    90719067.js .control-section:hover .accordion-section-title,
    90729068.js .control-section .accordion-section-title:hover,
    90739069.js .control-section.open .accordion-section-title,
    90749070.js .control-section .accordion-section-title:focus {
    9075     color: #fff;
    9076     text-shadow: 0 -1px 0 #333;
    9077     background: #808080;
    9078     background-image: -webkit-gradient(linear, left bottom, left top, from(#6d6d6d), to(#808080));
    9079     background-image: -webkit-linear-gradient(bottom, #6d6d6d, #808080);
    9080     background-image:    -moz-linear-gradient(bottom, #6d6d6d, #808080);
    9081     background-image:      -o-linear-gradient(bottom, #6d6d6d, #808080);
    9082     background-image: linear-gradient(to top, #6d6d6d, #808080);
    9083     border-left: 1px solid #808080;
    9084     border-right: 1px solid #808080;
    9085 }
    9086 
    9087 .js .control-section.accordion-section:hover,
    9088 .control-section.accordion-section.open {
    9089     border-top-color: #808080;
     9071    color: #000;
     9072    background: #f9f9f9;
     9073    background-image: -webkit-gradient(linear, left bottom, left top, from(#ececec), to(#f9f9f9));
     9074    background-image: -webkit-linear-gradient(bottom, #ececec, #f9f9f9);
     9075    background-image:    -moz-linear-gradient(bottom, #ececec, #f9f9f9);
     9076    background-image:      -o-linear-gradient(bottom, #ececec, #f9f9f9);
     9077    background-image: linear-gradient(to top, #ececec, #f9f9f9);
    90909078}
    90919079
    90929080.control-section.open .accordion-section-title {
    9093     border-bottom: 1px solid #6d6d6d;
     9081    border-bottom: 1px solid #dfdfdf;
    90949082}
    90959083
  • trunk/wp-admin/customize.php

    r23417 r24734  
    4747_wp_admin_html_begin();
    4848
    49 $body_class = 'wp-core-ui';
     49$body_class = 'wp-core-ui js';
    5050
    5151if ( wp_is_mobile() ) :
     
    9191        ?>
    9292
    93         <div class="wp-full-overlay-sidebar-content" tabindex="-1">
    94             <div id="customize-info" class="accordion-section<?php if ( $cannot_expand ) echo ' cannot-expand'; ?>">
     93        <div class="wp-full-overlay-sidebar-content accordion-container" tabindex="-1">
     94            <div id="customize-info" class="accordion-section <?php if ( $cannot_expand ) echo ' cannot-expand'; ?>">
    9595                <div class="accordion-section-title" aria-label="<?php esc_attr_e( 'Theme Customizer Options' ); ?>" tabindex="0">
    9696                    <span class="preview-notice"><?php
     
    112112            </div>
    113113
    114             <div id="customize-theme-controls" class="accordion-container"><ul>
     114            <div id="customize-theme-controls"><ul>
    115115                <?php
    116116                foreach ( $wp_customize->sections() as $section )
  • trunk/wp-admin/includes/template.php

    r24680 r24734  
    10011001    <?php
    10021002    $i = 0;
     1003    $first_open = false;
    10031004    do {
    10041005        if ( ! isset( $wp_meta_boxes ) || ! isset( $wp_meta_boxes[$page] ) || ! isset( $wp_meta_boxes[$page][$context] ) )
     
    10121013                    $i++;
    10131014                    $hidden_class = in_array( $box['id'], $hidden ) ? 'hide-if-js' : '';
     1015
     1016                    $open_class = '';
     1017                    if ( ! $first_open && empty( $hidden_class ) ) {
     1018                        $first_open = true;
     1019                        $open_class = 'open';
     1020                    }
    10141021                    ?>
    1015                     <li class="control-section accordion-section <?php echo $hidden_class; ?> <?php echo esc_attr( $box['id'] ); ?>" id="<?php echo esc_attr( $box['id'] ); ?>">
     1022                    <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'] ); ?>">
    10161023                        <h3 class="accordion-section-title hndle" tabindex="0" title="<?php echo esc_attr( $box['title'] ); ?>"><?php echo esc_html( $box['title'] ); ?></h3>
    10171024                        <div class="accordion-section-content <?php postbox_classes( $box['id'], $page ); ?>">
  • trunk/wp-admin/js/accordion.js

    r24680 r24734  
    1010
    1111            accordionSwitch( $( this ) );
    12             accordionCorners();
    1312        });
    1413
    15         // Refresh selected accordion option when screen options are toggled
     14        // Re-initialize accordion when screen options are toggled
    1615        $( '.hide-postbox-tog' ).click( function () {
    1716            accordionInit();
     
    2322        sectionContent   = $( '.accordion-section-content' );
    2423
    25     // Rounded corners
    26     function accordionCorners () {
     24    function accordionInit () {
     25        // Rounded corners
    2726        accordionOptions.removeClass( 'top bottom' );
    2827        accordionOptions.filter( ':visible' ).first().addClass( 'top' );
    29         accordionOptions.filter( ':visible' ).last().addClass( 'bottom' ).find( sectionContent ).addClass('bottom');
    30     };
    31 
    32     function accordionInit () {
    33         accordionSwitch( accordionOptions.filter( ':visible' ).first() );
    34         accordionCorners();
     28        accordionOptions.filter( ':visible' ).last().addClass( 'bottom' ).find( sectionContent ).addClass( 'bottom' );
    3529    }
    3630
    3731    function accordionSwitch ( el ) {
    3832        var section = el.closest( '.accordion-section' ),
    39             siblings = section.parent().find( '.open' ),
    40             content = section.find( sectionContent );
     33            siblings = section.closest( '.accordion-container' ).find( '.open' ),
     34            content = section.find( sectionContent );
    4135
    4236        if ( section.hasClass( 'cannot-expand' ) )
    4337            return;
    4438
    45         siblings.removeClass( 'open' );
    46         siblings.find( sectionContent ).show().slideUp( 150 );
    47         content.toggle( section.hasClass( 'open' ) ).slideToggle( 150 );
    48         section.toggleClass( 'open' );
     39        if ( section.hasClass( 'open' ) ) {
     40            section.toggleClass( 'open' );
     41            content.toggle( true ).slideToggle( 150 );
     42        } else {
     43            siblings.removeClass( 'open' );
     44            siblings.find( sectionContent ).show().slideUp( 150 );
     45            content.toggle( false ).slideToggle( 150 );
     46            section.toggleClass( 'open' );
     47        }
     48
     49        accordionInit();
    4950    }
    5051
    51     // Show the first accordion option by default
     52    // Initialize the accordion (currently just corner fixes)
    5253    accordionInit();
    5354
Note: See TracChangeset for help on using the changeset viewer.