Increase the color contrast of the toggle button border

Created on 13 February 2025, 6 months ago

Problem/Motivation

The user interface component of the toggle button to expand or collapse the navigation sidebar is not clearly distinguishable as a button and might go unnoticed cuz the caret facing to the left for LTR also has a lower contrast against the background compared to the caret facing to the right for every top level menu item that contains sub menu items (See the table in
https://docs.google.com/spreadsheets/d/1won35PxhRFexJYE8FmZ4DCNTo7xEAxC8... or toggle_button.xlsx.zip โ†’ for more details).


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

Steps to reproduce

Proposed resolution

  • It is not necessarily a compliance issue with WCAG but it would still be good, for the reasons outlined in the problems section, to increase the color contrast of the button border to have a 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

Merge Requests

Comments & Activities

  • Issue created by @rkoller
  • ๐Ÿ‡จ๐Ÿ‡ฆCanada mgifford Ottawa, Ontario

    The caret facing to the left is more or less invisible to most users I would think. It is too easy to miss as it isn't where folks are looking for this kind of a link.

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada mgifford Ottawa, Ontario

    This isn't a Gin issue specifically.

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada mgifford Ottawa, Ontario

    I think the menu module is the right place to do this.

    I don't know if this should be just for folks who have configured their browsers correctly, but we can start with them:

    @media (prefers-contrast: more), (forced-colors: active) {
    
      .admin-toolbar__expand-button {
        forced-color-adjust: none;
        background-color: ButtonFace !important;
        color: ButtonText !important;
        border: 4px solid ButtonText !important;
        box-shadow: none !important;
      }
    
      .admin-toolbar__expand-button:hover,
      .admin-toolbar__expand-button:focus-visible {
        background-color: Highlight !important;
        color: HighlightText !important;
        border-color: HighlightText !important;
        outline: 4px solid Highlight !important;
        outline-offset: 2px;
      }
    
      /* Make SVG chevron icon visible */
      .admin-toolbar__expand-button-chevron {
        fill: ButtonText !important;
        stroke: none !important;
      }
    }

    It would be interesting to see how that button features in user research. Certainly unsure how it would do with users who are using screen magnifiers.

  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany rkoller Nรผrnberg, Germany

    that button is strictly speaking in the navigation module. i posted it in the gin queue as well due to the fact that there is a dark and light mode and navigation in core only has a light mode so far. that was the reasoning behind opening an issue in gin as well.

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada mgifford Ottawa, Ontario

    I can move this to the navigation module.

    Is there a duplicate issue for this, or are you suggesting there should be another issue opened up?

  • ๐Ÿ‡ณ๐Ÿ‡ฟNew Zealand quietone

    In Drupal core changes are made on on 11.x (our main development branch) first, and are then back ported as needed according to the Core change policies โ†’ . Thanks

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia libbna New Delhi, India

    Hi,
    I checked and compared the colors of both carets. The right caret has a color of #4F5661, which gives a contrast ratio of 7.4:1, while the left caret uses #8590A3, resulting in a lower contrast ratio of 3.22:1.

    Just to confirm โ€” would you like me to update the left caret to use the same color as the right (#4F5661) for consistency and better contrast? Please confirm so I can proceed accordingly.

    I used the WebAIM Contrast Checker to verify the ratios.

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada mgifford Ottawa, Ontario

    Yes. That sounds right to me. Using the same color would make it easier to identify. Thanks.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia libbna New Delhi, India

    Cool. Thanks for confirming. I am working on it.

  • Pipeline finished with Failed
    24 days ago
    Total: 149s
    #548684
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia libbna New Delhi, India

    I have change the color of the arrow of toggle button to increase the contrast.

  • Pipeline finished with Success
    24 days ago
    Total: 537s
    #548691
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sdhruvi5142

    Hi, I've applied MR!12375 and verfied the changes and they are working as expected.

    Testing Steps:
    1. Enabled Navigation Module
    2. Check the Toggle button color in left drawer
    3. Observe the changes there.

    Testing Result:
    The color of both the toggles look same and the color contrast also got increases. Attaching screenshots fore reference. Can move this to RTBC+1

    Status : PASS

  • First commit to issue fork.
  • ๐Ÿ‡ซ๐Ÿ‡ทFrance nod_ Lille
  • Pipeline finished with Failed
    15 days ago
    Total: 489s
    #556873
  • ๐Ÿ‡ช๐Ÿ‡ธSpain ckrina Barcelona

    The slight color change in the arrow is OK on a visual perspective.

    • nod_ โ†’ committed 9271a55f on 11.2.x
      Issue #3506321 by libbna, rkoller, sdhruvi5142, mgifford, ckrina:...
  • ๐Ÿ‡ซ๐Ÿ‡ทFrance nod_ Lille

    Committed and pushed d6f8e99c4cd to 11.x and 9271a55faa8 to 11.2.x. Thanks!

    • nod_ โ†’ committed d6f8e99c on 11.x
      Issue #3506321 by libbna, rkoller, sdhruvi5142, mgifford, ckrina:...
  • ๐Ÿ‡ซ๐Ÿ‡ทFrance nod_ Lille
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia libbna New Delhi, India
Production build 0.71.5 2024