Navigation module button icons are obscured when in Windows High Contrast

Created on 9 August 2024, 3 months ago
Updated 4 September 2024, 2 months ago

Problem/Motivation

When in Windows High contrast mode, the icons are obscured by the data-attribute text that is being injected into the ::before pseudo element.

Steps to reproduce

  1. Emulate forced colors in Chromium: https://devtoolstips.org/tips/en/emulate-forced-colors/
  2. Notice the obscured icons

Proposed resolution

This is easy enough to fix through a style query (See https://developer.chrome.com/docs/css-ui/style-queries). Unfortunately FF and earlier versions of Safari don't support those. So I'm adding a style query and then fallback code.

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
NavigationΒ  β†’

Last updated about 2 hours ago

No maintainer
Created by

πŸ‡ΊπŸ‡ΈUnited States mherchel Gainesville, FL, US

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 @mherchel
  • Status changed to Needs review 3 months ago
  • πŸ‡ΊπŸ‡ΈUnited States mherchel Gainesville, FL, US
  • Pipeline finished with Success
    3 months ago
    Total: 433s
    #249208
  • Status changed to RTBC 3 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Thanks for https://devtoolstips.org/tips/en/emulate-forced-colors/

    Believe I'm seeing the issue being described and MR is making it better.

  • Status changed to Active 3 months ago
  • πŸ‡·πŸ‡ΈSerbia finnsky

    i have one question. Sorry

  • Status changed to Needs review 3 months ago
  • πŸ‡ΊπŸ‡ΈUnited States mherchel Gainesville, FL, US

    can it use same class selector? [class*="toolbar-button--icon"]

    This is a good thought, but unfortunately the "toolbar-button--icon--xxxx classes are added even if an icon doesn't exist. If we apply the styles to the items that do not have icons, then the helper text (the two letters) doesn't show.

    Markup with an icon

    Markup WITHOUT an icon

  • Given MR resolves mentioned issue.
    Reviewed and can be moved forward.

    Steps to reproduce

    1. Observed this issue with light theme(local set up windows/Mac ).
    2. Tested on Drupal version 11X and 10.3
    3. Install and open site in chrome
    4. Inspect and follows steps given in https://devtoolstips.org/tips/en/emulate-forced-colors/
    5. This will display page in high-contrast mode.
    6. Check icons.
    7. Given MR is fixing issue
    8. Attaching screenshot for before and after.

  • Status changed to RTBC 2 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Will say screenshots seem similar to whats already uploaded but believe @finnsky the question has been answered

  • πŸ‡·πŸ‡ΈSerbia finnsky

    Hello!

    I got my answer.

    But I can't say that I think this fix is ​​necessary or even urgent.

    Because in some foreseeable future we will have the ability to accurately understand whether there is an icon or not.
    The existing solution was added temporarily. And I don't think that we need to perfect the temporary solution.

    So for now we can leave only "@container style(--icon)" or even delay this task until we have controlled icons.

    But it's still up to the community to decide.

    Thanks for participating!

  • Status changed to Needs work 2 months ago
  • πŸ‡«πŸ‡·France nod_ Lille

    Can I get a followup (postponed) and a link in the CSS comment to remove this once the temporary solution is fixed?

    Thanks!

  • πŸ‡«πŸ‡·France nod_ Lille

    The CSS rule can be simplified like @finnsky suggested in the MR

  • πŸ‡ΊπŸ‡ΈUnited States mherchel Gainesville, FL, US

    The CSS rule can be simplified like @finnsky suggested in the MR

    See my comment in #6. The CSS rules cannot be simplified (unless all browsers support style queries). The reason is that all buttons get assigned a class with that includes [class*=toolbar-button--icon--], even if there is no SVG icon.

    The style query works fine. But doesn't yet support FF and Safari (Safari's not a big deal because I don't believe people use that with Windows High Contrast).

    So to be clear, I'm going to remove the long list of selectors, create (and postpone a followup), and then add a @todo?

  • πŸ‡·πŸ‡ΈSerbia finnsky

    @mherchel, i think yes. Actually maybe TODO not needed.

    This issue will not reproduced when we will know when button has icon:

    https://www.drupal.org/project/drupal/issues/3432173 πŸ“Œ Decide strategy to customize or provide 1st level menu items' icons Active

    Work should happend soon as far as i understand:
    https://drupal.slack.com/archives/C7AB68LJV/p1724335022875359

  • πŸ‡ΊπŸ‡ΈUnited States mherchel Gainesville, FL, US

    Maybe we should postpone this until that is done. We're in no hurry here as far as I know.

Production build 0.71.5 2024