Skip to content

Commit 0d56df9

Browse files
authored
Merge pull request #999 from DealsBeam/fix-password-strength-checker
Fixes the CSS selectors for the password strength indicator
2 parents 36953b1 + b7f2433 commit 0d56df9

File tree

1 file changed

+4
-17
lines changed

1 file changed

+4
-17
lines changed

Password-Strength-Checker/style.css

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,7 @@ input[type="password"]::placeholder {
136136
}
137137

138138
/* Strength levels with solid colors */
139-
input:not(:placeholder-shown):not(:valid):not(:invalid) ~ .strength {
140-
background: #ffe0e0;
141-
}
142-
143-
input:invalid:not(:placeholder-shown) ~ .strength {
139+
input:focus:invalid ~ .strength {
144140
background: #fff8e1;
145141
}
146142

@@ -161,11 +157,7 @@ input:valid ~ .strength {
161157
}
162158

163159
/* Optional */
164-
input:not(:placeholder-shown):not(:valid):not(:invalid) ~ .strength::after {
165-
background: #f57c00;
166-
}
167-
168-
input:invalid:not(:placeholder-shown) ~ .strength::after {
160+
input:focus:invalid ~ .strength::after {
169161
background: #d32f2f;
170162
}
171163

@@ -174,7 +166,7 @@ input:valid ~ .strength::after {
174166
}
175167

176168
/* Trigger animation when password is being typed */
177-
input:not(:placeholder-shown) ~ .strength::after {
169+
input:focus ~ .strength::after {
178170
transform: scaleX(1);
179171
}
180172

@@ -189,12 +181,7 @@ input:not(:placeholder-shown) ~ .strength::after {
189181
transition: opacity 0.3s ease;
190182
}
191183

192-
input:not(:placeholder-shown):not(:valid):not(:invalid) ~ .strength-text {
193-
opacity: 1;
194-
color: #d32f2f;
195-
}
196-
197-
input:invalid:not(:placeholder-shown) ~ .strength-text {
184+
input:focus:invalid ~ .strength-text {
198185
opacity: 1;
199186
color: #f57c00;
200187
}

0 commit comments

Comments
 (0)