Accessibility: Improve and modernize user interface controls. Sixth part: allow checkboxes and radio buttons to scale with text.

- uses a SVG icon for checkboxes
- uses CSS `rem` relative units

Props kjellr, afercia, audrasjb.
Fixes #47498.

Built from https://develop.svn.wordpress.org/trunk@46248


git-svn-id: http://core.svn.wordpress.org/trunk@46060 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrea Fercia 2019-09-23 16:51:57 +00:00
parent 165ac34260
commit 6cb8e14790
34 changed files with 123 additions and 122 deletions

View File

@ -2,6 +2,9 @@
@import 'variables'; @import 'variables';
@import 'mixins'; @import 'mixins';
@function url-friendly-colour( $color ) {
@return '%23' + str-slice( '#{ $color }', 2, -1 );
}
body { body {
background: $body-background; background: $body-background;
@ -30,11 +33,11 @@ div.dashboard-widget-submit input:hover,
/* Forms */ /* Forms */
input[type=checkbox]:checked:before { input[type=checkbox]:checked::before {
color: $form-checked; content: url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M14.83%204.89l1.34.94-5.81%208.38H9.02L5.78%209.67l1.34-1.25%202.57%202.4z%27%20fill%3D%27#{url-friendly-colour($form-checked)}%27%2F%3E%3C%2Fsvg%3E");
} }
input[type=radio]:checked:before { input[type=radio]:checked::before {
background: $form-checked; background: $form-checked;
} }

View File

@ -24,11 +24,11 @@ div.dashboard-widget-submit input:hover,
} }
/* Forms */ /* Forms */
input[type=checkbox]:checked:before { input[type=checkbox]:checked::before {
color: #096484; content: url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M14.83%204.89l1.34.94-5.81%208.38H9.02L5.78%209.67l1.34-1.25%202.57%202.4z%27%20fill%3D%27%23096484%27%2F%3E%3C%2Fsvg%3E");
} }
input[type=radio]:checked:before { input[type=radio]:checked::before {
background: #096484; background: #096484;
} }

File diff suppressed because one or more lines are too long

View File

@ -24,11 +24,11 @@ div.dashboard-widget-submit input:hover,
} }
/* Forms */ /* Forms */
input[type=checkbox]:checked:before { input[type=checkbox]:checked::before {
color: #096484; content: url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M14.83%204.89l1.34.94-5.81%208.38H9.02L5.78%209.67l1.34-1.25%202.57%202.4z%27%20fill%3D%27%23096484%27%2F%3E%3C%2Fsvg%3E");
} }
input[type=radio]:checked:before { input[type=radio]:checked::before {
background: #096484; background: #096484;
} }

File diff suppressed because one or more lines are too long

View File

@ -24,11 +24,11 @@ div.dashboard-widget-submit input:hover,
} }
/* Forms */ /* Forms */
input[type=checkbox]:checked:before { input[type=checkbox]:checked::before {
color: #59524c; content: url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M14.83%204.89l1.34.94-5.81%208.38H9.02L5.78%209.67l1.34-1.25%202.57%202.4z%27%20fill%3D%27%2359524c%27%2F%3E%3C%2Fsvg%3E");
} }
input[type=radio]:checked:before { input[type=radio]:checked::before {
background: #59524c; background: #59524c;
} }

File diff suppressed because one or more lines are too long

View File

@ -24,11 +24,11 @@ div.dashboard-widget-submit input:hover,
} }
/* Forms */ /* Forms */
input[type=checkbox]:checked:before { input[type=checkbox]:checked::before {
color: #59524c; content: url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M14.83%204.89l1.34.94-5.81%208.38H9.02L5.78%209.67l1.34-1.25%202.57%202.4z%27%20fill%3D%27%2359524c%27%2F%3E%3C%2Fsvg%3E");
} }
input[type=radio]:checked:before { input[type=radio]:checked::before {
background: #59524c; background: #59524c;
} }

File diff suppressed because one or more lines are too long

View File

@ -24,11 +24,11 @@ div.dashboard-widget-submit input:hover,
} }
/* Forms */ /* Forms */
input[type=checkbox]:checked:before { input[type=checkbox]:checked::before {
color: #523f6d; content: url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M14.83%204.89l1.34.94-5.81%208.38H9.02L5.78%209.67l1.34-1.25%202.57%202.4z%27%20fill%3D%27%23523f6d%27%2F%3E%3C%2Fsvg%3E");
} }
input[type=radio]:checked:before { input[type=radio]:checked::before {
background: #523f6d; background: #523f6d;
} }

File diff suppressed because one or more lines are too long

View File

@ -24,11 +24,11 @@ div.dashboard-widget-submit input:hover,
} }
/* Forms */ /* Forms */
input[type=checkbox]:checked:before { input[type=checkbox]:checked::before {
color: #523f6d; content: url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M14.83%204.89l1.34.94-5.81%208.38H9.02L5.78%209.67l1.34-1.25%202.57%202.4z%27%20fill%3D%27%23523f6d%27%2F%3E%3C%2Fsvg%3E");
} }
input[type=radio]:checked:before { input[type=radio]:checked::before {
background: #523f6d; background: #523f6d;
} }

File diff suppressed because one or more lines are too long

View File

@ -24,11 +24,11 @@ div.dashboard-widget-submit input:hover,
} }
/* Forms */ /* Forms */
input[type=checkbox]:checked:before { input[type=checkbox]:checked::before {
color: #04a4cc; content: url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M14.83%204.89l1.34.94-5.81%208.38H9.02L5.78%209.67l1.34-1.25%202.57%202.4z%27%20fill%3D%27%2304a4cc%27%2F%3E%3C%2Fsvg%3E");
} }
input[type=radio]:checked:before { input[type=radio]:checked::before {
background: #04a4cc; background: #04a4cc;
} }

File diff suppressed because one or more lines are too long

View File

@ -24,11 +24,11 @@ div.dashboard-widget-submit input:hover,
} }
/* Forms */ /* Forms */
input[type=checkbox]:checked:before { input[type=checkbox]:checked::before {
color: #04a4cc; content: url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M14.83%204.89l1.34.94-5.81%208.38H9.02L5.78%209.67l1.34-1.25%202.57%202.4z%27%20fill%3D%27%2304a4cc%27%2F%3E%3C%2Fsvg%3E");
} }
input[type=radio]:checked:before { input[type=radio]:checked::before {
background: #04a4cc; background: #04a4cc;
} }

File diff suppressed because one or more lines are too long

View File

@ -24,11 +24,11 @@ div.dashboard-widget-submit input:hover,
} }
/* Forms */ /* Forms */
input[type=checkbox]:checked:before { input[type=checkbox]:checked::before {
color: #e14d43; content: url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M14.83%204.89l1.34.94-5.81%208.38H9.02L5.78%209.67l1.34-1.25%202.57%202.4z%27%20fill%3D%27%23e14d43%27%2F%3E%3C%2Fsvg%3E");
} }
input[type=radio]:checked:before { input[type=radio]:checked::before {
background: #e14d43; background: #e14d43;
} }

File diff suppressed because one or more lines are too long

View File

@ -24,11 +24,11 @@ div.dashboard-widget-submit input:hover,
} }
/* Forms */ /* Forms */
input[type=checkbox]:checked:before { input[type=checkbox]:checked::before {
color: #e14d43; content: url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M14.83%204.89l1.34.94-5.81%208.38H9.02L5.78%209.67l1.34-1.25%202.57%202.4z%27%20fill%3D%27%23e14d43%27%2F%3E%3C%2Fsvg%3E");
} }
input[type=radio]:checked:before { input[type=radio]:checked::before {
background: #e14d43; background: #e14d43;
} }

File diff suppressed because one or more lines are too long

View File

@ -24,11 +24,11 @@ div.dashboard-widget-submit input:hover,
} }
/* Forms */ /* Forms */
input[type=checkbox]:checked:before { input[type=checkbox]:checked::before {
color: #738e96; content: url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M14.83%204.89l1.34.94-5.81%208.38H9.02L5.78%209.67l1.34-1.25%202.57%202.4z%27%20fill%3D%27%23738e96%27%2F%3E%3C%2Fsvg%3E");
} }
input[type=radio]:checked:before { input[type=radio]:checked::before {
background: #738e96; background: #738e96;
} }

File diff suppressed because one or more lines are too long

View File

@ -24,11 +24,11 @@ div.dashboard-widget-submit input:hover,
} }
/* Forms */ /* Forms */
input[type=checkbox]:checked:before { input[type=checkbox]:checked::before {
color: #738e96; content: url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M14.83%204.89l1.34.94-5.81%208.38H9.02L5.78%209.67l1.34-1.25%202.57%202.4z%27%20fill%3D%27%23738e96%27%2F%3E%3C%2Fsvg%3E");
} }
input[type=radio]:checked:before { input[type=radio]:checked::before {
background: #738e96; background: #738e96;
} }

File diff suppressed because one or more lines are too long

View File

@ -24,11 +24,11 @@ div.dashboard-widget-submit input:hover,
} }
/* Forms */ /* Forms */
input[type=checkbox]:checked:before { input[type=checkbox]:checked::before {
color: #dd823b; content: url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M14.83%204.89l1.34.94-5.81%208.38H9.02L5.78%209.67l1.34-1.25%202.57%202.4z%27%20fill%3D%27%23dd823b%27%2F%3E%3C%2Fsvg%3E");
} }
input[type=radio]:checked:before { input[type=radio]:checked::before {
background: #dd823b; background: #dd823b;
} }

File diff suppressed because one or more lines are too long

View File

@ -24,11 +24,11 @@ div.dashboard-widget-submit input:hover,
} }
/* Forms */ /* Forms */
input[type=checkbox]:checked:before { input[type=checkbox]:checked::before {
color: #dd823b; content: url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M14.83%204.89l1.34.94-5.81%208.38H9.02L5.78%209.67l1.34-1.25%202.57%202.4z%27%20fill%3D%27%23dd823b%27%2F%3E%3C%2Fsvg%3E");
} }
input[type=radio]:checked:before { input[type=radio]:checked::before {
background: #dd823b; background: #dd823b;
} }

File diff suppressed because one or more lines are too long

View File

@ -79,14 +79,14 @@ input[type="radio"] {
cursor: pointer; cursor: pointer;
display: inline-block; display: inline-block;
line-height: 0; line-height: 0;
height: 16px; height: 1rem;
margin: -4px 0 0 4px; margin: -0.25rem 0 0 0.25rem;
outline: 0; outline: 0;
padding: 0 !important; padding: 0 !important;
text-align: center; text-align: center;
vertical-align: middle; vertical-align: middle;
width: 16px; width: 1rem;
min-width: 16px; min-width: 1rem;
-webkit-appearance: none; -webkit-appearance: none;
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
transition: .05s border-color ease-in-out; transition: .05s border-color ease-in-out;
@ -117,36 +117,35 @@ td > input[type="checkbox"],
input[type="radio"] { input[type="radio"] {
border-radius: 50%; border-radius: 50%;
margin-left: 4px; margin-left: 0.25rem;
line-height: 0.71428571; line-height: 0.71428571;
} }
input[type="checkbox"]:checked:before, input[type="checkbox"]:checked::before,
input[type="radio"]:checked:before { input[type="radio"]:checked::before {
float: right; float: right;
display: inline-block; display: inline-block;
vertical-align: middle; vertical-align: middle;
width: 16px; width: 1rem;
font: normal 21px/1 dashicons;
speak: none; speak: none;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }
input[type="checkbox"]:checked:before { input[type="checkbox"]:checked::before {
content: "\f147"; /* Use the "Yes" SVG Dashicon */
margin: -3px -4px 0 0; content: url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M14.83%204.89l1.34.94-5.81%208.38H9.02L5.78%209.67l1.34-1.25%202.57%202.4z%27%20fill%3D%27%231e8cbe%27%2F%3E%3C%2Fsvg%3E");
color: #1e8cbe; margin: -0.1875rem -0.25rem 0 0;
height: 1.3125rem;
width: 1.3125rem;
} }
input[type="radio"]:checked:before { input[type="radio"]:checked::before {
content: "\2022"; content: "";
text-indent: -9999px; border-radius: 50%;
border-radius: 50px; width: 50%;
font-size: 24px; height: 50%;
width: 6px; margin: 25%;
height: 6px;
margin: 4px;
line-height: 0.76190476; line-height: 0.76190476;
background-color: #1e8cbe; background-color: #1e8cbe;
} }
@ -1287,7 +1286,6 @@ table.form-table td .updated p {
.widefat thead td input[type="checkbox"], .widefat thead td input[type="checkbox"],
.widefat tfoot td input[type="checkbox"] { .widefat tfoot td input[type="checkbox"] {
-webkit-appearance: none; -webkit-appearance: none;
padding: 10px;
} }
.widefat th input[type="checkbox"], .widefat th input[type="checkbox"],
@ -1300,26 +1298,27 @@ table.form-table td .updated p {
.widefat th input[type="checkbox"]:before, .widefat th input[type="checkbox"]:before,
.widefat thead td input[type="checkbox"]:before, .widefat thead td input[type="checkbox"]:before,
.widefat tfoot td input[type="checkbox"]:before { .widefat tfoot td input[type="checkbox"]:before {
font: normal 30px/1 dashicons; width: 1.875rem;
margin: -3px -5px; height: 1.875rem;
margin: -0.1875rem -0.3125rem;
} }
input[type="radio"], input[type="radio"],
input[type="checkbox"] { input[type="checkbox"] {
height: 25px; height: 1.5625rem;
width: 25px; width: 1.5625rem;
} }
.wp-admin p input[type="checkbox"], .wp-admin p input[type="checkbox"],
.wp-admin p input[type="radio"] { .wp-admin p input[type="radio"] {
margin-top: -3px; margin-top: -0.1875rem;
} }
input[type="radio"]:checked:before { input[type="radio"]:checked:before {
vertical-align: middle; vertical-align: middle;
width: 9px; width: 0.5625rem;
height: 9px; height: 0.5625rem;
margin: 7px; margin: 0.4375rem;
line-height: 0.76190476; line-height: 0.76190476;
} }

File diff suppressed because one or more lines are too long

View File

@ -79,14 +79,14 @@ input[type="radio"] {
cursor: pointer; cursor: pointer;
display: inline-block; display: inline-block;
line-height: 0; line-height: 0;
height: 16px; height: 1rem;
margin: -4px 4px 0 0; margin: -0.25rem 0.25rem 0 0;
outline: 0; outline: 0;
padding: 0 !important; padding: 0 !important;
text-align: center; text-align: center;
vertical-align: middle; vertical-align: middle;
width: 16px; width: 1rem;
min-width: 16px; min-width: 1rem;
-webkit-appearance: none; -webkit-appearance: none;
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
transition: .05s border-color ease-in-out; transition: .05s border-color ease-in-out;
@ -117,36 +117,35 @@ td > input[type="checkbox"],
input[type="radio"] { input[type="radio"] {
border-radius: 50%; border-radius: 50%;
margin-right: 4px; margin-right: 0.25rem;
line-height: 0.71428571; line-height: 0.71428571;
} }
input[type="checkbox"]:checked:before, input[type="checkbox"]:checked::before,
input[type="radio"]:checked:before { input[type="radio"]:checked::before {
float: left; float: left;
display: inline-block; display: inline-block;
vertical-align: middle; vertical-align: middle;
width: 16px; width: 1rem;
font: normal 21px/1 dashicons;
speak: none; speak: none;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }
input[type="checkbox"]:checked:before { input[type="checkbox"]:checked::before {
content: "\f147"; /* Use the "Yes" SVG Dashicon */
margin: -3px 0 0 -4px; content: url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M14.83%204.89l1.34.94-5.81%208.38H9.02L5.78%209.67l1.34-1.25%202.57%202.4z%27%20fill%3D%27%231e8cbe%27%2F%3E%3C%2Fsvg%3E");
color: #1e8cbe; margin: -0.1875rem 0 0 -0.25rem;
height: 1.3125rem;
width: 1.3125rem;
} }
input[type="radio"]:checked:before { input[type="radio"]:checked::before {
content: "\2022"; content: "";
text-indent: -9999px; border-radius: 50%;
border-radius: 50px; width: 50%;
font-size: 24px; height: 50%;
width: 6px; margin: 25%;
height: 6px;
margin: 4px;
line-height: 0.76190476; line-height: 0.76190476;
background-color: #1e8cbe; background-color: #1e8cbe;
} }
@ -1287,7 +1286,6 @@ table.form-table td .updated p {
.widefat thead td input[type="checkbox"], .widefat thead td input[type="checkbox"],
.widefat tfoot td input[type="checkbox"] { .widefat tfoot td input[type="checkbox"] {
-webkit-appearance: none; -webkit-appearance: none;
padding: 10px;
} }
.widefat th input[type="checkbox"], .widefat th input[type="checkbox"],
@ -1300,26 +1298,27 @@ table.form-table td .updated p {
.widefat th input[type="checkbox"]:before, .widefat th input[type="checkbox"]:before,
.widefat thead td input[type="checkbox"]:before, .widefat thead td input[type="checkbox"]:before,
.widefat tfoot td input[type="checkbox"]:before { .widefat tfoot td input[type="checkbox"]:before {
font: normal 30px/1 dashicons; width: 1.875rem;
margin: -3px -5px; height: 1.875rem;
margin: -0.1875rem -0.3125rem;
} }
input[type="radio"], input[type="radio"],
input[type="checkbox"] { input[type="checkbox"] {
height: 25px; height: 1.5625rem;
width: 25px; width: 1.5625rem;
} }
.wp-admin p input[type="checkbox"], .wp-admin p input[type="checkbox"],
.wp-admin p input[type="radio"] { .wp-admin p input[type="radio"] {
margin-top: -3px; margin-top: -0.1875rem;
} }
input[type="radio"]:checked:before { input[type="radio"]:checked:before {
vertical-align: middle; vertical-align: middle;
width: 9px; width: 0.5625rem;
height: 9px; height: 0.5625rem;
margin: 7px; margin: 0.4375rem;
line-height: 0.76190476; line-height: 0.76190476;
} }

File diff suppressed because one or more lines are too long

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.3-alpha-46247'; $wp_version = '5.3-alpha-46248';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.