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.


git-svn-id: https://develop.svn.wordpress.org/trunk@38672 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrea Fercia
2016-09-28 19:53:07 +00:00
parent 02cf2a731f
commit ee7f970ffa
52 changed files with 126 additions and 125 deletions

View File

@@ -423,11 +423,11 @@ function wp_comment_reply( $position = 1, $checkbox = false, $mode = 'single', $
</div>
<p id="replysubmit" class="submit">
<a href="#comments-form" class="save button-primary alignright">
<a href="#comments-form" class="save button button-primary alignright">
<span id="addbtn" style="display:none;"><?php _e('Add Comment'); ?></span>
<span id="savebtn" style="display:none;"><?php _e('Update Comment'); ?></span>
<span id="replybtn" style="display:none;"><?php _e('Submit Reply'); ?></span></a>
<a href="#comments-form" class="cancel button-secondary alignleft"><?php _e('Cancel'); ?></a>
<a href="#comments-form" class="cancel button alignleft"><?php _e('Cancel'); ?></a>
<span class="waiting spinner"></span>
<span class="error" style="display:none;"></span>
</p>
@@ -657,7 +657,7 @@ function meta_form( $post = null ) {
<tr><td colspan="2">
<div class="submit">
<?php submit_button( __( 'Add Custom Field' ), 'secondary', 'addmeta', false, array( 'id' => 'newmeta-submit', 'data-wp-lists' => 'add:the-list:newmeta' ) ); ?>
<?php submit_button( __( 'Add Custom Field' ), '', 'addmeta', false, array( 'id' => 'newmeta-submit', 'data-wp-lists' => 'add:the-list:newmeta' ) ); ?>
</div>
<?php wp_nonce_field( 'add-meta', '_ajax_nonce-add-meta', false ); ?>
</td></tr>
@@ -1513,7 +1513,7 @@ function find_posts_div($found_action = '') {
<div id="find-posts-response"></div>
</div>
<div class="find-box-buttons">
<?php submit_button( __( 'Select' ), 'button-primary alignright', 'find-posts-submit', false ); ?>
<?php submit_button( __( 'Select' ), 'primary alignright', 'find-posts-submit', false ); ?>
<div class="clear"></div>
</div>
</div>
@@ -1914,10 +1914,11 @@ function get_submit_button( $text = '', $type = 'primary large', $name = 'submit
continue;
$classes[] = in_array( $t, $button_shorthand ) ? 'button-' . $t : $t;
}
$class = implode( ' ', array_unique( $classes ) );
// Remove empty items, remove duplicate items, and finally build a string.
$class = implode( ' ', array_unique( array_filter( $classes ) ) );
if ( 'delete' === $type )
$class = 'button-secondary delete';
$class = 'button delete';
$text = $text ? $text : __( 'Save Changes' );