Accessibility: Improve the Tags meta box accessibility.

- changes the "X" links in buttons, improves their color contrast ratio and focus style
- adds screen reader text "Remove item: + tagname"
- uses `wp.a11y.speak()` to give screen reader users feedback when adding/removing tags
- makes the `tagcloud-link` toggle a button, with an `aria-expanded` attribute to indicate the tag cloud collapsed/expanded state
- changes colors for the autocomplete highlighted option in order to have a better color contrast ratio
- reduces the font size for the autocomplete on Press This
- removes CSS related to the old `suggest.js` from Press This

Props joedolson, cgrymala, azaozz, afercia.
Fixes #27555.


git-svn-id: https://develop.svn.wordpress.org/trunk@38880 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrea Fercia
2016-10-23 18:15:07 +00:00
parent dcd129e5b8
commit e232ed28dc
11 changed files with 244 additions and 121 deletions

View File

@@ -759,7 +759,7 @@ img.emoji {
/* @todo can we combine these into a class or use an existing dashicon one? */
.welcome-panel .welcome-panel-close:before,
.tagchecklist span a:before,
.tagchecklist .ntdelbutton .remove-tag-icon:before,
#bulk-titles div a:before,
.notice-dismiss:before {
background: none;
@@ -779,18 +779,41 @@ img.emoji {
margin: 0;
}
.tagchecklist span a:before,
#bulk-titles div a:before {
margin: 1px 0;
}
.tagchecklist .ntdelbutton .remove-tag-icon:before {
margin-left: 2px;
-webkit-border-radius: 50%;
border-radius: 50%;
color: #0073aa;
/* vertically center the icon cross browsers */
line-height: 1.28;
}
.tagchecklist .ntdelbutton:focus {
outline: 0;
}
.welcome-panel .welcome-panel-close:hover:before,
.welcome-panel .welcome-panel-close:focus:before,
.tagchecklist span a:hover:before,
#bulk-titles div a:hover:before {
.tagchecklist .ntdelbutton:hover .remove-tag-icon:before,
.tagchecklist .ntdelbutton:focus .remove-tag-icon:before,
#bulk-titles div a:hover:before,
#bulk-titles div a:focus:before {
color: #c00;
}
.tagchecklist .ntdelbutton:focus .remove-tag-icon:before {
-webkit-box-shadow:
0 0 0 1px #5b9dd9,
0 0 2px 1px rgba(30, 140, 190, .8);
box-shadow:
0 0 0 1px #5b9dd9,
0 0 2px 1px rgba(30, 140, 190, .8);
}
.key-labels label {
line-height: 24px;
}
@@ -3571,9 +3594,7 @@ img {
.sidebar-name-arrow,
.sidebar-name:hover .sidebar-name-arrow,
.meta-box-sortables .postbox:hover .handlediv,
.tagchecklist span a,
#bulk-titles div a,
.tagchecklist span a:hover,
#bulk-titles div a:hover {
background: none !important;
}

View File

@@ -276,7 +276,9 @@ body {
box-sizing: border-box;
-webkit-transition: 0.18s -webkit-transform cubic-bezier(0.645, 0.045, 0.355, 1);
transition: 0.18s -webkit-transform cubic-bezier(0.645, 0.045, 0.355, 1);
-webkit-transition: 0.18s transform cubic-bezier(0.645, 0.045, 0.355, 1);
transition: 0.18s transform cubic-bezier(0.645, 0.045, 0.355, 1);
-webkit-transition: 0.18s transform cubic-bezier(0.645, 0.045, 0.355, 1), 0.18s -webkit-transform cubic-bezier(0.645, 0.045, 0.355, 1);
transition: 0.18s transform cubic-bezier(0.645, 0.045, 0.355, 1), 0.18s -webkit-transform cubic-bezier(0.645, 0.045, 0.355, 1); /* easeInOutCubic */
}

View File

@@ -582,10 +582,9 @@ span.wp-media-buttons-icon:before {
position: absolute;
}
.tagchecklist span {
margin-right: 25px;
display: block;
.tagchecklist > span {
float: left;
margin-right: 25px;
font-size: 13px;
line-height: 1.8em;
cursor: default;
@@ -594,16 +593,16 @@ span.wp-media-buttons-icon:before {
text-overflow: ellipsis;
}
.tagchecklist span a {
margin: 1px 0 0 -17px;
cursor: pointer;
width: 20px;
height: 20px;
display: block;
float: left;
text-indent: 0;
overflow: hidden;
.tagchecklist .ntdelbutton {
position: absolute;
width: 24px;
height: 24px;
border: none;
margin: 0 0 0 -19px;
padding: 0;
background: none;
cursor: pointer;
text-indent: 0;
}
#poststuff h3.hndle, /* Back-compat for pre-4.4 */
@@ -1027,6 +1026,25 @@ span.description,
width: 260px;
}
.tagcloud-link.button-link {
color: #0073aa;
text-decoration: underline;
}
.tagcloud-link.button-link:hover {
color: #00a0d2;
}
.tagcloud-link.button-link:focus {
color: #124964;
-webkit-box-shadow:
0 0 0 1px #5b9dd9,
0 0 2px 1px rgba(30, 140, 190, .8);
box-shadow:
0 0 0 1px #5b9dd9,
0 0 2px 1px rgba(30, 140, 190, .8);
}
#post-body-content .tagsdiv .the-tags {
margin: 0 5px;
}
@@ -1052,6 +1070,7 @@ p.popular-tags a {
margin: 2px 0 12px;
}
/* Suggest.js autocomplete, no more used by core. */
.ac_results {
display: none;
margin: -1px 0 0;
@@ -1438,7 +1457,7 @@ table.links-table {
margin: 25px 10px;
}
.tagchecklist span {
.tagchecklist > span {
font-size: 16px;
line-height: 1.4;
}

View File

@@ -594,11 +594,18 @@ ul#add-to-blog-users {
padding: 4px 10px;
white-space: nowrap;
text-align: left;
cursor: pointer;
}
.ui-autocomplete li.ui-state-focus {
/* Colors for the wplink toolbar autocomplete. */
.ui-autocomplete .ui-state-focus {
background-color: #ddd;
cursor: pointer;
}
/* Colors for the tags autocomplete. */
.wp-tags-autocomplete .ui-state-focus {
background-color: #0073aa;
color: #fff;
}
/*------------------------------------------------------------------------------

View File

@@ -441,11 +441,15 @@ div#dashboard-widgets {
padding-right: 1px;
}
.tagchecklist span, .tagchecklist span a {
.tagchecklist > span, .tagchecklist .ntdelbutton {
display: inline-block;
display: block;
}
.tagchecklist .ntdelbutton:focus .remove-tag-icon:before {
outline: 1px solid #5b9dd9;
}
.tablenav .button,
.nav .button {
padding-top: 2px;

View File

@@ -770,38 +770,6 @@ dd {
margin: 10px 0 6px 16px;
}
/* Tag hint TODO needed? */
/* Tag suggestions */
.ac_results {
padding: 0;
margin: -1px 0 0 -1px;
list-style: none;
position: absolute;
z-index: 10000;
display: none;
border: 1px solid #d8d8d8;
background-color: #fff;
font-size: 14px;
}
.ac_results li {
padding: 6px 16px;
white-space: nowrap;
text-align: left;
}
.ac_results .ac_over {
background-color: #e5e5e5;
background-color: #00a0d2;
color: #fff;
cursor: pointer;
}
.ac_match {
text-decoration: underline;
}
/* Tags */
.tagchecklist {
padding: 16px 28px 5px;
@@ -817,10 +785,9 @@ dd {
clear: both;
}
.tagchecklist span {
display: block;
margin-right: 25px;
.tagchecklist > span {
float: left;
margin-right: 25px;
font-size: 13px;
line-height: 1.8;
white-space: nowrap;
@@ -828,7 +795,7 @@ dd {
}
@media (max-width: 600px) {
.tagchecklist span {
.tagchecklist > span {
margin-bottom: 15px;
font-size: 16px;
line-height: 1.3;
@@ -836,36 +803,51 @@ dd {
}
.tagchecklist .ntdelbutton {
margin: 1px 0 0 -17px;
cursor: pointer;
width: 20px;
height: 20px;
display: block;
float: left;
text-indent: 0;
overflow: hidden;
position: absolute;
outline: 0;
width: 24px;
height: 24px;
border: none;
margin: 0 0 0 -19px;
padding: 0;
background: none;
cursor: pointer;
text-indent: 0;;
position: absolute;
}
.tagchecklist .ntdelbutton:before {
.tagchecklist .ntdelbutton .remove-tag-icon:before {
content: "\f153";
display: block;
margin: 2px 0;
margin-left: 2px;
height: 20px;
width: 20px;
background: 0 0;
color: #9ea7af;
font: 400 16px/1 dashicons;
-webkit-border-radius: 50%;
border-radius: 50%;
background: transparent;
color: #0073aa;
/* line-height tweak to vertically center the icon cross browsers */
font: 400 16px/1.28 dashicons;
text-align: center;
speak: none;
-webkit-font-smoothing: antialiased;
}
.tagchecklist .ntdelbutton:focus:before {
color: #00a0d2;
.tagchecklist .ntdelbutton:focus {
outline: 0;
}
.tagchecklist .ntdelbutton:hover .remove-tag-icon:before,
.tagchecklist .ntdelbutton:focus .remove-tag-icon:before {
color: #c00;
}
.tagchecklist .ntdelbutton:focus .remove-tag-icon:before {
-webkit-box-shadow:
0 0 0 1px #5b9dd9,
0 0 2px 1px rgba(30, 140, 190, .8);
box-shadow:
0 0 0 1px #5b9dd9,
0 0 2px 1px rgba(30, 140, 190, .8);
}
/* THE TAG CLOUD. */
.tagsdiv + p {
@@ -2194,6 +2176,7 @@ html {
-webkit-box-shadow: 0 1px 2px rgba( 30, 140, 190, 0.8 );
box-shadow: 0 1px 2px rgba( 30, 140, 190, 0.8 );
background-color: #fff;
font-size: 14px;
}
.ui-autocomplete li {
@@ -2201,9 +2184,16 @@ html {
padding: 4px 10px;
white-space: nowrap;
text-align: left;
}
.ui-autocomplete li.ui-state-focus {
background-color: #ddd;
cursor: pointer;
}
/* Colors for the wplink toolbar autocomplete. */
.ui-autocomplete .ui-state-focus {
background-color: #ddd;
}
/* Colors for the tags autocomplete. */
.wp-tags-autocomplete .ui-state-focus {
background-color: #0073aa;
color: #fff;
}