Skip to content

Commit de9dd59

Browse files
essjay05ok7sai
authored andcommitted
fix(aria/combobox): improve autocomplete placeholder text color contrast (#33465)
* fix(aria/combobox): improve autocomplete placeholder text color contrast Updates Angular Aria's autocomplete styles to improve the text color contrast of the placeholder text to meet accessibilityrequirements and improve text readability. Fixes b/477617379 * refactor(aria/combobox): fix stylelint-disable redundancy Removes redundant stylelint-disable lines. * refactor(aria/combobox): add context for reason for ::placeholder styles Updates comment in added ::placeholder styles to note the styles are primarily for internal testing. (cherry picked from commit e2cab48)
1 parent 3b74812 commit de9dd59

1 file changed

Lines changed: 30 additions & 9 deletions

File tree

src/components-examples/aria/autocomplete/autocomplete.css

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,36 @@
55

66
/* stylelint-disable-next-line material/no-prefixes -- Valid in all remotely recent browsers. */
77
width: fit-content;
8+
9+
/* The ::placeholder selectors are intentionally separated.
10+
The 'material/no-prefixes' stylelint rule flags the standard ::placeholder
11+
when grouped with vendor prefixes. Each prefix is on its own rule to comply.
12+
Vendor prefixes are included to ensure consistent placeholder styling
13+
across different browsers.
14+
15+
NOTE: These styles are primarily needed for internal testing. */
16+
17+
/* stylelint-disable material/no-prefixes -- Provides all prefixes for ::placeholder */
18+
input::-webkit-input-placeholder {
19+
color: var(--mat-sys-on-surface-variant);
20+
}
21+
22+
input::-moz-placeholder /* Firefox 19+ */ {
23+
color: var(--mat-sys-on-surface-variant);
24+
}
25+
26+
input:-ms-input-placeholder /* IE 10+ */ {
27+
color: var(--mat-sys-on-surface-variant);
28+
}
29+
30+
input:-moz-placeholder /* Firefox 18- */ {
31+
color: var(--mat-sys-on-surface-variant);
32+
}
33+
34+
input::placeholder {
35+
color: var(--mat-sys-on-surface-variant);
36+
}
37+
838
}
939

1040
.example-search-icon,
@@ -116,12 +146,3 @@ input[ngCombobox]:disabled {
116146
font-size: 0.9rem;
117147
}
118148

119-
/* stylelint-disable material/no-prefixes -- Provides all prefixes for ::placeholder */
120-
input::-webkit-input-placeholder,
121-
input::-moz-placeholder, /* Firefox 19+ */
122-
input:-ms-input-placeholder, /* IE 10+ */
123-
input:-moz-placeholder, /* Firefox 18- */
124-
input::placeholder {
125-
color: var(--mat-sys-on-surface-variant);
126-
}
127-
/* stylelint-enable material/no-prefixes */

0 commit comments

Comments
 (0)