Accessibility: Make some Widgets buttons real buttons.

Links used as UI controls that behave like buttons, should be buttons.
- changes the widgets "toggle", "Delete", and "Close" links to buttons
- uses `aria-expanded` to announce the state of the toggle buttons
- increases a bit the clickable area of the toggle
- ensures the "circular focus" doesn't get cut-off in some browsers by centering the toggle arrows
- uses a `<span>` element with an `aria-hidden` attribute to hide CSS generated font icons from assistive technologies
- standardizes on `.toggle-indicator:before` rather than `:after`
- changes two `#f00` reds in `#dc3232`, see #35622

Fixes #31476.


git-svn-id: https://develop.svn.wordpress.org/trunk@40480 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrea Fercia
2017-04-19 21:13:53 +00:00
parent 9c5ba6f387
commit 66eb13d3b2
8 changed files with 73 additions and 60 deletions

View File

@@ -865,8 +865,6 @@ hr {
border-bottom: 1px solid #fafafa;
}
.widget-control-remove,
.widget-control-remove:focus,
.row-actions span.delete a,
.row-actions span.trash a,
.row-actions span.spam a,
@@ -893,14 +891,10 @@ span.required,
#media-items a.delete:hover,
#media-items a.delete-permanently:hover,
#nav-menu-footer .menu-delete:hover {
color: #f00;
color: #dc3232;
border: none;
}
.widget-control-remove:hover {
color: #f00;
}
/*------------------------------------------------------------------------------
3.0 - Actions
------------------------------------------------------------------------------*/
@@ -3244,25 +3238,24 @@ img {
/* @todo: can we use a common class for these? */
.nav-menus-php .item-edit:before,
.widget-top a.widget-action:after,
.widget-top .widget-action .toggle-indicator:before,
.control-section .accordion-section-title:after,
.accordion-section-title:after {
right: 0;
content: "\f140";
border: none;
background: none;
font: normal 20px/1 dashicons;
speak: none;
display: block;
padding: 0;
text-indent: 0;
text-align: center;
position: relative;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-decoration: none !important;
}
.widget-top .widget-action .toggle-indicator:before {
padding: 1px 2px 1px 0px;
-webkit-border-radius: 50%;
border-radius: 50%;
}
.handlediv,
.postbox .handlediv.button-link,
.item-edit,
@@ -3288,15 +3281,7 @@ img {
color: #23282d;
}
.widget-top a.widget-action:after {
padding: 1px 2px 1px 0px;
margin-top: 10px;
margin-right: 10px;
-webkit-border-radius: 50%;
border-radius: 50%;
}
.widget-top a.widget-action:focus:after {
.widget-top .widget-action:focus .toggle-indicator:before {
-webkit-box-shadow:
0 0 0 1px #5b9dd9,
0 0 2px 1px rgba(30,140,190,.8);
@@ -3315,7 +3300,7 @@ img {
.control-section.open .accordion-section-title:after,
#customize-info.open .accordion-section-title:after,
.nav-menus-php .menu-item-edit-active .item-edit:before,
.widget.open .widget-top a.widget-action:after {
.widget.open .widget-top .widget-action .toggle-indicator:before {
content: "\f142";
}
@@ -3594,8 +3579,8 @@ img {
/* @todo: evaluate - most of these were likely replaced by dashicons */
.curtime #timestamp,
#screen-meta-links a.show-settings,
.widget-top a.widget-action,
.widget-top a.widget-action:hover,
.widget-top .widget-action,
.widget-top .widget-action:hover,
.sidebar-name-arrow,
.sidebar-name:hover .sidebar-name-arrow,
.meta-box-sortables .postbox:hover .handlediv,

View File

@@ -153,7 +153,7 @@
text-align: center;
}
.wp-customizer .menu-item.menu-item-edit-active .item-edit .toggle-indicator:after {
.wp-customizer .menu-item.menu-item-edit-active .item-edit .toggle-indicator:before {
content: "\f142";
}
@@ -271,17 +271,18 @@
display: inline-block;
font-size: 20px;
line-height: 1;
text-indent: -1px; /* account for the dashicon alignment */
}
.rtl .wp-customizer .toggle-indicator {
text-indent: 1px; /* account for the dashicon alignment */
}
.wp-customizer .toggle-indicator:after {
.wp-customizer .menu-item .item-edit .toggle-indicator:before,
#available-menu-items .accordion-section-title .toggle-indicator:before {
content: "\f140";
display: block;
padding: 1px 2px 1px 0px;
speak: none;
vertical-align: top;
-webkit-border-radius: 50%;
border-radius: 50%;
color: #72777c;
@@ -494,13 +495,13 @@
content: none !important;
}
#available-menu-items .accordion-section-title:hover .toggle-indicator:after,
#available-menu-items .button-link:hover .toggle-indicator:after,
#available-menu-items .button-link:focus .toggle-indicator:after {
#available-menu-items .accordion-section-title:hover .toggle-indicator:before,
#available-menu-items .button-link:hover .toggle-indicator:before,
#available-menu-items .button-link:focus .toggle-indicator:before {
color: #23282d;
}
#available-menu-items .open .accordion-section-title .toggle-indicator:after {
#available-menu-items .open .accordion-section-title .toggle-indicator:before {
content: "\f142";
color: #23282d;
}
@@ -837,7 +838,7 @@ li.assigned-to-menu-location .add-new-menu-item {
.wp-customizer .menu-item .submitbox .submitdelete:focus,
.customize-screen-options-toggle:focus:before,
#customize-controls .customize-info .customize-help-toggle:focus:before,
.wp-customizer button:focus .toggle-indicator:after,
.wp-customizer button:focus .toggle-indicator:before,
.menu-delete:focus,
.menu-item-bar .item-delete:focus:before,
#available-menu-items .item-add:focus:before {

View File

@@ -89,15 +89,15 @@
line-height: 16px;
}
.customize-control-widget_form.expanded a.widget-action:after {
.customize-control-widget_form.expanded .widget-action .toggle-indicator:before {
content: "\f142";
}
.customize-control-widget_form.wide-widget-control a.widget-action:after {
.customize-control-widget_form.wide-widget-control .widget-action .toggle-indicator:before {
content: "\f139";
}
.customize-control-widget_form.wide-widget-control.expanded a.widget-action:after {
.customize-control-widget_form.wide-widget-control.expanded .widget-action .toggle-indicator:before {
content: "\f141";
}
@@ -438,9 +438,13 @@ body.adding-widget #customize-preview {
.last-widget {
margin-bottom: 15px;
}
/* This rule reduces the widgets titles height. */
.widget-title h3 {
padding: 13px 15px;
}
.widget-top .widget-action {
padding-bottom: 8px;
}
.widget-reorder-nav span {
height: 39px;
}

View File

@@ -14,12 +14,13 @@
background: #f7f7f7;
}
.widget-top a.widget-action,
.widget-top a.widget-action:hover {
-webkit-box-shadow: none;
box-shadow: none;
.widget-top .widget-action {
border: 0;
margin: 0;
padding: 10px;
background: none;
cursor: pointer;
outline: none;
text-decoration: none;
}
.widget-title h3,
@@ -50,7 +51,7 @@
}
.deleting .widget-title,
.deleting .widget-top a.widget-action:after {
.deleting .widget-top .widget-action .toggle-indicator:before {
color: #a0a5aa;
}