Skip to content

Commit 0f5fbd3

Browse files
committed
[design] improve radio and checkbox accessibility
1 parent 990094e commit 0f5fbd3

File tree

2 files changed

+26
-7
lines changed

2 files changed

+26
-7
lines changed

‎src/css/form.css‎

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,9 @@ input[type="radio"]{
326326

327327
input[type="checkbox"]+label,
328328
input[type="radio"]+label{
329+
padding:0.5em;
330+
margin:-0.25em-0.5em;
331+
border-radius:var(--theme-radius);
329332
color:rgb(var(--form-label));
330333
font-size:1em;
331334
font-family:var(--font-regular);
@@ -334,19 +337,21 @@ input[type="radio"]+label{
334337
flex-direction: row;
335338
justify-content: flex-start;
336339
align-items: flex-start;
337-
transition: transform var(--layout-timing-extra-fast), color var(--layout-timing-extra-fast);
340+
transition: transform var(--layout-timing-extra-fast), color var(--layout-timing-extra-fast), box-shadow var(--layout-timing-extra-fast);
338341
}
339342

340-
input[type="checkbox"]:focus+label,
341343
input[type="checkbox"]:hover+label,
342-
input[type="radio"]:focus+label,
343-
input[type="radio"]:hover+label{
344+
input[type="checkbox"]:focus+label,
345+
input[type="radio"]:hover+label,
346+
input[type="radio"]:focus+label{
344347
color:rgb(var(--form-label-hover));
348+
box-shadow:var(--form-hover-ring);
345349
}
346350

347351
input[type="checkbox"]:active+label,
348352
input[type="radio"]:active+label{
349353
color:rgb(var(--form-label-focus-active));
354+
box-shadow:var(--form-focus-ring-accent);
350355
}
351356

352357
input[type="checkbox"]:checked+label,
@@ -355,8 +360,13 @@ input[type="radio"]:checked+label{
355360
}
356361

357362
input[type="checkbox"]:disabled+label,
358-
input[type="radio"]:disabled+label{
363+
input[type="checkbox"]:disabled:hover+label,
364+
input[type="checkbox"]:disabled:focus+label,
365+
input[type="radio"]:disabled+label,
366+
input[type="radio"]:disabled:hover+label,
367+
input[type="radio"]:disabled:focus+label{
359368
color:rgb(var(--form-label-disabled));
369+
box-shadow: none;
360370
cursor: default;
361371
}
362372

@@ -974,6 +984,8 @@ input[type="range"]:disabled::-moz-range-progress{
974984
.form-gridinput[type="checkbox"]+label,
975985
.form-gridinput[type="radio"]+label{
976986
background-color: transparent;
987+
padding:0;
988+
margin:0;
977989
display: block;
978990
width:calc(var(--form-thumb-size) *1.75);
979991
height:calc(var(--form-thumb-size) *1.75);
@@ -982,6 +994,13 @@ input[type="range"]:disabled::-moz-range-progress{
982994
z-index:1;
983995
}
984996

997+
.form-gridinput[type="checkbox"]:hover+label,
998+
.form-gridinput[type="checkbox"]:focus+label,
999+
.form-gridinput[type="radio"]:hover+label,
1000+
.form-gridinput[type="radio"]:focus+label{
1001+
box-shadow: none;
1002+
}
1003+
9851004
.form-gridinput[type="checkbox"]+label:before,
9861005
.form-gridinput[type="radio"]+label:before{
9871006
content:"";

‎src/css/variables.css‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@
103103
--form-group-text-border-disabled:var(--theme-gray-01);
104104
--form-border-disabled:var(--theme-gray-02);
105105
--form-icon:var(--theme-gray-08);
106-
--form-icon-hover-focus:var(--theme-gray-20);
107-
--form-icon-active:var(--theme-accent);
106+
--form-icon-hover-focus:var(--theme-gray-16);
107+
--form-icon-active:var(--theme-style-text);
108108
--form-icon-checked:var(--theme-style-text);
109109
--form-icon-disabled:var(--theme-gray-04);
110110
--form-placeholder:var(--theme-gray-06);

0 commit comments

Comments
(0)