Skip to content

Commit

Permalink
Fix Autocomplete Component styling with UI Colors for dark mode (#12443)
Browse files Browse the repository at this point in the history
* Fix Reports/Block inventory autocomplete select fields dark mode contrast colors
Followed color variables of default UI controls as possible.

* Style input text inside autocomplete select component for dark mode to an accesibility-friendly contrast.

* Remove input element outline
  • Loading branch information
ramram-mf authored Jun 10, 2024
1 parent 8481a51 commit 1e42cbb
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions network-api/networkapi/wagtailcustomization/static/css/admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,48 @@ fieldset ul li div label {
.required .field > label::after {
display: inline-block !important;
}

/* Fix select2 dropdown autocomplete input field low contrast color scheme on dark mode */
@media (prefers-color-scheme: dark) {
#wagtail .select2 .select2-selection {
color: var(--w-color-text-context);
background-color: var(--w-color-surface-field);
border-color: var(--w-color-border-field-default);
border-radius: 0.3125rem;
}
#wagtail .select2-container .select2-results .select2-results__options {
background-color: var(--w-color-surface-field);
}
/* Hover/Focus; Important for accesibility */
#wagtail .select2 .select2-selection:hover,
#wagtail .select2 .select2-selection:focus {
border-color: var(--w-color-border-field-hover);
}
/* Options */
#wagtail .select2-container .select2-results .select2-results__option {
color: var(--w-color-text-context);
background-color: var(--w-color-surface-field);
}
/* Selected/hover option */
#wagtail
.select2-container
.select2-results
.select2-results__option--highlighted {
color: var(--w-color-text-label-menus-active);
background-color: var(--w-color-surface-button-default);
}
/* Input element */
#wagtail
.select2-container--default
.select2-search--inline
.select2-search__field {
color: var(--w-color-text-context);
}
/* Focus input outline */
#wagtail
.select2-container--default
.select2-search--inline
.select2-search__field:focus-visible {
outline: none !important;
}
}

0 comments on commit 1e42cbb

Please sign in to comment.