Skip to content

Commit dd88c61

Browse files
authored
Merge pull request #2803 from abhi-innovaccer/feat-switch-outline-focus
feat(switch): enhance focus and existing states with outlines and bor…
2 parents 653fb3a + f9621ea commit dd88c61

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

css/src/components/switch.module.css

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,14 @@
4242
}
4343

4444
.Switch-input:focus ~ .Switch-wrapper {
45-
box-shadow: var(--shadow-spread) var(--secondary-shadow);
45+
outline: var(--border-width-05) solid var(--primary-focus);
46+
outline-offset: var(--spacing-05);
4647
background-color: var(--secondary-light);
4748
}
4849

4950
.Switch-input:focus ~ .Switch-wrapper--checked {
50-
box-shadow: var(--shadow-spread) var(--primary-shadow);
51+
outline: var(--border-width-05) solid var(--primary-focus);
52+
outline-offset: var(--spacing-05);
5153
background-color: var(--primary);
5254
}
5355

@@ -67,6 +69,14 @@
6769
background-color: var(--primary-darker);
6870
}
6971

72+
.Switch-input:active ~ .Switch-wrapper:before {
73+
border-color: var(--inverse-light);
74+
}
75+
76+
.Switch-input:active ~ .Switch-wrapper--checked:before {
77+
border-color: transparent;
78+
}
79+
7080
.Switch-wrapper--tiny {
7181
border-radius: var(--border-radius-full);
7282
}
@@ -88,6 +98,7 @@
8898
border-radius: var(--border-radius-full);
8999
box-sizing: border-box;
90100
transition-duration: 80ms;
101+
border: var(--border-width-2-5) solid var(--inverse-lighter);
91102
}
92103

93104
.Switch-wrapper--checked {
@@ -102,6 +113,7 @@
102113
-ms-transform: translateX(100%);
103114
transform: translateX(100%);
104115
transition-duration: 80ms;
116+
border-color: transparent;
105117
}
106118

107119
.Switch--disabled {
@@ -112,6 +124,14 @@
112124
background-color: var(--secondary-lighter);
113125
}
114126

127+
.Switch-wrapper--disabled:before {
128+
border-color: var(--secondary-dark);
129+
}
130+
115131
.Switch-wrapper--checkedDisabled {
116132
background-color: var(--primary-lighter);
117133
}
134+
135+
.Switch-wrapper--checkedDisabled:before {
136+
border-color: transparent;
137+
}

0 commit comments

Comments
 (0)