Skip to content

Commit a1d3ddb

Browse files
committed
Accessibility: Make buttons to add site images look like buttons.
The buttons to add site icons, logos, header images, and background images were designed with a dashed border. This led to confusion with users thinking they were drop regions for image uploads, rather than buttons to trigger an upload. Change design of upload buttons to clarify expected user interaction. Props emaildano, afercia, joedolson, ankitkumarshah, logicrays, shailu25. Fixes #47579. git-svn-id: https://develop.svn.wordpress.org/trunk@60645 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 946649a commit a1d3ddb

File tree

7 files changed

+27
-36
lines changed

7 files changed

+27
-36
lines changed

src/js/_enqueues/wp/customize/views.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,14 @@
3737

3838
setButtons: function() {
3939
var elements = $('#customize-control-header_image .actions .remove');
40+
var addButton = $('#customize-control-header_image .actions .new');
41+
4042
if (this.model.get('choice')) {
4143
elements.show();
44+
addButton.removeClass('upload-button');
4245
} else {
4346
elements.hide();
47+
addButton.addClass('upload-button');
4448
}
4549
}
4650
});

src/wp-admin/css/customize-controls.css

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,6 +1441,21 @@ p.customize-section-description {
14411441
white-space: normal;
14421442
}
14431443

1444+
.customize-control .attachment-media-view .upload-button {
1445+
width: 100%;
1446+
padding: 9px 0;
1447+
}
1448+
1449+
.customize-control .attachment-media-view .upload-button.control-focus {
1450+
width: auto;
1451+
padding: 0 10px;
1452+
}
1453+
1454+
.customize-control.customize-control-header .actions .upload-button.button.new {
1455+
width: 100%;
1456+
padding: 9px 0;
1457+
}
1458+
14441459
.customize-control .attachment-media-view .thumbnail,
14451460
.customize-control-header .current .container {
14461461
overflow: hidden;
@@ -2990,6 +3005,10 @@ body.adding-widget .add-new-widget:before,
29903005
vertical-align: middle;
29913006
}
29923007

3008+
.customize-control .attachment-media-view .upload-button {
3009+
padding: 5px 0;
3010+
}
3011+
29933012
#customize-control-changeset_status .customize-inside-control-row {
29943013
padding-top: 15px;
29953014
}

src/wp-admin/css/forms.css

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -789,32 +789,6 @@ ul#add-to-blog-users {
789789
outline: 2px solid transparent;
790790
}
791791

792-
.button-add-site-icon {
793-
width: 100%;
794-
cursor: pointer;
795-
text-align: center;
796-
border: 1px dashed #c3c4c7;
797-
box-sizing: border-box;
798-
padding: 9px 0;
799-
line-height: 1.6;
800-
max-width: 270px;
801-
border-radius: 4px;
802-
background: #f0f0f1;
803-
}
804-
805-
.button-add-site-icon:focus,
806-
.button-add-site-icon:hover {
807-
background: #fff;
808-
}
809-
810-
.button-add-site-icon:focus {
811-
background-color: #fff;
812-
border-color: #3582c4;
813-
border-style: solid;
814-
box-shadow: 0 0 0 1px #3582c4;
815-
outline: 2px solid transparent;
816-
}
817-
818792
/*------------------------------------------------------------------------------
819793
15.0 - Comments Screen
820794
------------------------------------------------------------------------------*/

src/wp-admin/options-general.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
wp_enqueue_media();
106106
wp_enqueue_script( 'site-icon' );
107107

108-
$classes_for_upload_button = 'upload-button button-add-media button-add-site-icon';
108+
$classes_for_upload_button = 'upload-button button-hero button';
109109
$classes_for_update_button = 'button';
110110
$classes_for_wrapper = '';
111111

src/wp-includes/customize/class-wp-customize-header-image-control.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,6 @@ public function print_header_image_template() {
173173
<img src="{{data.header.thumbnail_url}}" alt="{{data.header.alt_text || data.header.description}}" />
174174

175175
<# } #>
176-
<# } else { #>
177-
178-
<div class="placeholder">
179-
<?php _e( 'No image set' ); ?>
180-
</div>
181-
182176
<# } #>
183177
</script>
184178
<?php
@@ -246,7 +240,7 @@ public function render_content() {
246240
<div class="actions">
247241
<?php if ( current_user_can( 'upload_files' ) ) : ?>
248242
<button type="button"<?php echo $visibility; ?> class="button remove" aria-label="<?php esc_attr_e( 'Hide header image' ); ?>"><?php _e( 'Hide image' ); ?></button>
249-
<button type="button" class="button new" id="header_image-button" aria-label="<?php esc_attr_e( 'Add Header Image' ); ?>"><?php _e( 'Add Image' ); ?></button>
243+
<button type="button" class="button new <?php echo ! $this->get_current_image_src() ? '' : 'customize-header-image-not-selected'; ?>" id="header_image-button" aria-label="<?php esc_attr_e( 'Add Header Image' ); ?>"><?php _e( 'Add Image' ); ?></button>
250244
<?php endif; ?>
251245
</div>
252246
<div class="choices">

src/wp-includes/customize/class-wp-customize-media-control.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ public function content_template() {
196196
<# } else { #>
197197
<div class="attachment-media-view">
198198
<# if ( data.canUpload ) { #>
199-
<button type="button" class="upload-button button-add-media" {{{ describedByAttr }}}>{{ data.button_labels.select }}</button>
199+
<button type="button" class="upload-button button" {{{ describedByAttr }}}>{{ data.button_labels.select }}</button>
200200
<# } #>
201201
<div class="actions">
202202
<# if ( data.defaultAttachment ) { #>

src/wp-includes/customize/class-wp-customize-site-icon-control.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public function content_template() {
126126
<# } else { #>
127127
<div class="attachment-media-view">
128128
<# if ( data.canUpload ) { #>
129-
<button type="button" class="upload-button button-add-media"><?php echo $this->button_labels['site_icon']; ?></button>
129+
<button type="button" class="upload-button button"><?php echo $this->button_labels['site_icon']; ?></button>
130130
<# } #>
131131
<div class="actions">
132132
<# if ( data.defaultAttachment ) { #>

0 commit comments

Comments
 (0)