Increase the color contrast for components like appearance switch, select elements, checkboxes, radio buttons, text fields, text areas, and date fields

Created on 13 February 2025, 5 months ago

Problem/Motivation

In dark mode the color contrast of the border against the adjacent background color of the component is below 3:1 to meet SC1.4.11 (See the table in
https://docs.google.com/spreadsheets/d/1won35PxhRFexJYE8FmZ4DCNTo7xEAxC8... or component.background.xlsx.zip for more details). The following article provides some more background information about SC1.4.11: https://yatil.net/blog/non-text-contrast-in-detail-ui-components

Discussed and iterated on the issue with @mgifford, @the_g_bomb, @katannshaw, and @drupa11y

Steps to reproduce

  • Check some of the components on for example admin/appearance/settings/gin

Proposed resolution

  • Increase the contrast for --gin-bg-input against --gin-border-color-form-element in dark mode to get a color contrast of at least 3:1

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

4.0

Component

User interface

Created by

🇩🇪Germany rkoller Nürnberg, Germany

Live updates comments and jobs are added and updated live.
  • Accessibility

    It affects the ability of people with disabilities or special needs (such as blindness or color-blindness) to use Drupal.

Sign in to follow issues

Comments & Activities

  • Issue created by @rkoller
  • 🇩🇪Germany rkoller Nürnberg, Germany
  • 🇨🇦Canada mgifford Ottawa, Ontario

    With the image provided, I've updated the Steps to reproduce above.

    There are some possible improvements from:

    @media (prefers-contrast: more), (forced-colors: active) {
    
      /* Save button (primary) */
      #edit-submit.form-submit,
      input[type="submit"].button--primary {
        forced-color-adjust: none;
        background-color: ButtonFace !important;
        color: ButtonText !important;
        border: 2px solid ButtonText !important;
        font-weight: bold;
        box-shadow: 0 0 0 2px ButtonText !important;
      }
    
      #edit-submit.form-submit:hover,
      #edit-submit.form-submit:focus-visible {
        background-color: Highlight !important;
        color: HighlightText !important;
        border-color: HighlightText !important;
        outline: 2px solid Highlight !important;
        outline-offset: 2px;
      }
    
      /* Preview button (secondary) */
      #gin-sticky-edit-preview.form-submit {
        forced-color-adjust: none;
        background-color: Canvas !important;
        color: ButtonText !important;
        border: 2px dashed ButtonText !important;
        font-weight: normal;
        box-shadow: 0 0 0 1px ButtonText !important;
      }
    
      #gin-sticky-edit-preview.form-submit:hover,
      #gin-sticky-edit-preview.form-submit:focus-visible {
        background-color: Highlight !important;
        color: HighlightText !important;
        border-color: HighlightText !important;
        outline: 2px solid Highlight !important;
        outline-offset: 2px;
      }
    
      /* Hide Sidebar Panel button */
      .meta-sidebar__trigger.trigger {
        forced-color-adjust: none;
        background-color: ButtonFace !important;
        color: ButtonText !important;
        border: 1px solid ButtonText !important;
        border-radius: 50%;
        width: 2.25rem;
        height: 2.25rem;
      }
    
      .meta-sidebar__trigger.trigger:hover,
      .meta-sidebar__trigger.trigger:focus-visible {
        background-color: Highlight !important;
        color: HighlightText !important;
        outline: 2px solid Highlight !important;
        outline-offset: 2px;
      }
    
      .meta-sidebar__trigger.trigger svg {
        fill: ButtonText !important;
      }
    }

    But I got a different looking input with forced colors enabled.

Production build 0.71.5 2024