Make WordPress Core

Ticket #33754: 33754.patch

File 33754.patch, 5.5 KB (added by afercia, 10 years ago)
  • src/wp-admin/css/common.css

     
    17861786}
    17871787
    17881788.postbox .handlediv {
     1789        display: none;
    17891790        float: right;
    1790         width: 33px;
     1791        width: 36px;
    17911792        height: 36px;
     1793        padding: 0;
    17921794}
    17931795
    17941796.js .postbox .handlediv {
    1795         cursor: pointer;
     1797        display: block;
    17961798}
    17971799
    17981800.sortable-placeholder {
     
    27252727
    27262728/* Metabox collapse arrow indicators */
    27272729.js .sidebar-name .sidebar-name-arrow:before,
    2728 .js .meta-box-sortables .postbox .handlediv:before {
    2729         right: 12px;
     2730.js .meta-box-sortables .postbox .toggle-indicator:before {
     2731        position: relative;
     2732        left: -1px; /* fix the dashicon horizontal alignment */
     2733        display: inline-block;
    27302734        font: normal 20px/1 dashicons;
    27312735        speak: none;
    2732         display: inline-block;
    2733         padding: 8px 10px;
    2734         top: 0;
    2735         position: relative;
     2736        padding: 8px;
    27362737        -webkit-font-smoothing: antialiased;
    27372738        -moz-osx-font-smoothing: grayscale;
    27382739        text-decoration: none !important;
    27392740}
    27402741
     2742.js .sidebar-name .sidebar-name-arrow:before {
     2743        padding: 10px;
     2744        left: 0;
     2745}
     2746
    27412747.js #widgets-left .sidebar-name .sidebar-name-arrow {
    27422748        display: none;
    27432749}
     
    27492755
    27502756/* Show the arrow only on hover */
    27512757.js .sidebar-name .sidebar-name-arrow:before,
    2752 .js .meta-box-sortables .postbox .handlediv:before {
     2758.js .meta-box-sortables .postbox .toggle-indicator:before {
    27532759        content: '\f142';
    27542760}
    27552761
    27562762.js .widgets-holder-wrap.closed .sidebar-name-arrow:before,
    2757 .js .meta-box-sortables .postbox.closed .handlediv:before {
     2763.js .meta-box-sortables .postbox.closed .handlediv .toggle-indicator:before {
    27582764        content: '\f140';
    27592765}
    27602766
     
    28892895
    28902896.widget-action:hover,
    28912897.handlediv:hover,
     2898.handlediv:focus,
    28922899.item-edit:hover,
    28932900.sidebar-name:hover .sidebar-name-arrow,
    28942901.accordion-section-title:hover:after {
  • src/wp-admin/css/widgets.css

     
    147147        margin: 0 10px 0 0;
    148148}
    149149
    150 div#widgets-left .sidebar-name .sidebar-name-arrow:before {
    151         right: 0;
    152         top: 4px;
    153         padding: 4px 6px 4px 4px;
     150#widgets-left .sidebar-name .sidebar-name-arrow:before {
     151        padding: 9px;
    154152}
    155153
    156154#widgets-left #available-widgets,
     
    250248}
    251249
    252250div#widgets-right .sidebar-name .sidebar-name-arrow:before {
    253         right: 0;
    254         top: 4px;
     251        top: 2px;
    255252}
    256253
    257254div#widgets-right .widget-top {
  • src/wp-admin/includes/template.php

     
    10961096                                        $hidden_class = in_array($box['id'], $hidden) ? ' hide-if-js' : '';
    10971097                                        echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . $hidden_class . '" ' . '>' . "\n";
    10981098                                        if ( 'dashboard_browser_nag' != $box['id'] ) {
    1099                                                 echo '<button class="handlediv button-link" title="' . esc_attr__( 'Click to toggle' ) . '" aria-expanded="true">';
    1100                                                 echo '<span class="screen-reader-text">' . sprintf( __( 'Click to toggle %s panel' ), $box['title'] ) . '</span><br />';
     1099                                                echo '<button type="button" class="handlediv button-link" aria-expanded="true">';
     1100                                                echo '<span class="screen-reader-text">' . sprintf( __( 'Toggle panel: %s' ), $box['title'] ) . '</span>';
     1101                                                echo '<span class="toggle-indicator" aria-hidden="true"></span>';
    11011102                                                echo '</button>';
    11021103                                        }
    11031104                                        echo "<h3 class='hndle'><span>{$box['title']}</span></h3>\n";
  • src/wp-admin/js/postbox.js

     
    77
    88        postboxes = {
    99                add_postbox_toggles : function(page, args) {
    10                         var self = this;
     10                        var self = this,
     11                                $handles = $( '.postbox .hndle, .postbox .handlediv' );
    1112
    1213                        self.init(page, args);
    1314
    14                         $('.postbox .hndle, .postbox .handlediv').bind('click.postboxes', function( e ) {
    15                                 var p = $(this).parent('.postbox'), id = p.attr('id');
     15                        $handles.on( 'click.postboxes', function() {
     16                                var p = $( this ).parent( '.postbox' ),
     17                                        id = p.attr( 'id' ),
     18                                        ariaExpandedValue;
    1619
    1720                                if ( 'dashboard_browser_nag' == id )
    1821                                        return;
    1922
    20                                 e.preventDefault();
    21 
    2223                                p.toggleClass( 'closed' );
    23                                 $(this).attr( 'aria-expanded', ! p.hasClass( 'closed' ) );
    2424
     25                                ariaExpandedValue = ! p.hasClass( 'closed' );
     26
     27                                if ( $( this ).hasClass( 'handlediv' ) ) {
     28                                        // The handle button was clicked.
     29                                        $( this ).attr( 'aria-expanded', ariaExpandedValue );
     30                                } else {
     31                                        // The handle heading was clicked.
     32                                        $( this ).closest( '.postbox' ).find( 'button.handlediv' ).attr( 'aria-expanded', ariaExpandedValue );
     33                                }
     34
    2535                                if ( page != 'press-this' )
    2636                                        self.save_state(page);
    2737
     
    7484                },
    7585
    7686                init : function(page, args) {
    77                         var isMobile = $(document.body).hasClass('mobile');
     87                        var isMobile = $( document.body ).hasClass( 'mobile' ),
     88                                $handleButtons = $( '.postbox .handlediv' );
    7889
    7990                        $.extend( this, args || {} );
    8091                        $('#wpbody-content').css('overflow','hidden');
     
    112123                        }
    113124
    114125                        this._mark_area();
     126
     127                        // Set the `aria-expanded` handle buttons attribute on page load.
     128                        $handleButtons.each( function() {
     129                                var p = $( this ).parent( '.postbox' );
     130                                $( this ).attr( 'aria-expanded', ! p.hasClass( 'closed' ) );
     131                        });
    115132                },
    116133
    117134                save_state : function(page) {