WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/28/2016 07:53:07 PM (3 years ago)
Author:
afercia
Message:

Administration: Improve the usage of the button CSS classes.

Introduces some consistency in the usage of the button CSS classes, fixes the
focus style for accessibility and responsiveness of the buttons.

  • Adds the button class to all primary buttons make them responsive
  • Removes all secondary-button classes and replaces it with button when needed. button-secondary shouldn't be used and exists just for backward compatibility reasons
  • Replaces classes inside submit_button() with a shorthand for some buttons, and use an empty string for the default button class. Passing button is unnecessary
  • Adjusts get_submit_button() to remove empty items

Props iseulde, dimchik, chris_d2d, mhowell, afercia.
Fixes #27314, #37138, #37448.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/template.php

    r38470 r38672  
    424424
    425425    <p id="replysubmit" class="submit">
    426     <a href="#comments-form" class="save button-primary alignright">
     426    <a href="#comments-form" class="save button button-primary alignright">
    427427    <span id="addbtn" style="display:none;"><?php _e('Add Comment'); ?></span>
    428428    <span id="savebtn" style="display:none;"><?php _e('Update Comment'); ?></span>
    429429    <span id="replybtn" style="display:none;"><?php _e('Submit Reply'); ?></span></a>
    430     <a href="#comments-form" class="cancel button-secondary alignleft"><?php _e('Cancel'); ?></a>
     430    <a href="#comments-form" class="cancel button alignleft"><?php _e('Cancel'); ?></a>
    431431    <span class="waiting spinner"></span>
    432432    <span class="error" style="display:none;"></span>
     
    658658<tr><td colspan="2">
    659659<div class="submit">
    660 <?php submit_button( __( 'Add Custom Field' ), 'secondary', 'addmeta', false, array( 'id' => 'newmeta-submit', 'data-wp-lists' => 'add:the-list:newmeta' ) ); ?>
     660<?php submit_button( __( 'Add Custom Field' ), '', 'addmeta', false, array( 'id' => 'newmeta-submit', 'data-wp-lists' => 'add:the-list:newmeta' ) ); ?>
    661661</div>
    662662<?php wp_nonce_field( 'add-meta', '_ajax_nonce-add-meta', false ); ?>
     
    15141514        </div>
    15151515        <div class="find-box-buttons">
    1516             <?php submit_button( __( 'Select' ), 'button-primary alignright', 'find-posts-submit', false ); ?>
     1516            <?php submit_button( __( 'Select' ), 'primary alignright', 'find-posts-submit', false ); ?>
    15171517            <div class="clear"></div>
    15181518        </div>
     
    19151915        $classes[] = in_array( $t, $button_shorthand ) ? 'button-' . $t : $t;
    19161916    }
    1917     $class = implode( ' ', array_unique( $classes ) );
     1917    // Remove empty items, remove duplicate items, and finally build a string.
     1918    $class = implode( ' ', array_unique( array_filter( $classes ) ) );
    19181919
    19191920    if ( 'delete' === $type )
    1920         $class = 'button-secondary delete';
     1921        $class = 'button delete';
    19211922
    19221923    $text = $text ? $text : __( 'Save Changes' );
Note: See TracChangeset for help on using the changeset viewer.