Skip to content

[Bug]: Tree component is not built with High Contrast in mind. #33711

@arolariu

Description

@arolariu

Component

Tree

Package version

9.55.0

React version

18.2.0

Environment

System:
    OS: Linux 6.5 Ubuntu 22.04.5 LTS 22.04.5 LTS (Jammy Jellyfish)
    CPU: (16) x64 AMD EPYC 7763 64-Core Processor
    Memory: 53.59 GB / 62.78 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash

Current Behavior

Hi,

Just a random question, feel free to redirect me if this has been asked before and/or this scenario is documented somewhere:

  • Are the Tree and TreeItem components built with high contrast accessibility in mind?

I've searched in the docs and I cannot find any reference to how this component should behave in high contrast;
The problem that I am having is regarding the :hover visual appearance - in high contrast it feels broken / non-existent.

Example of the :hover state on a tree item (grabbed straight from the docs: https://react.fluentui.dev/?path=/docs/components-tree--docs#appearance):

Normal mode:

Image

High Contrast mode:

Image

As you can see (open in separate tab for better visibility) - there is a faint background-color css attribute that is applied for the tree items, on hover, in normal mode.
The same background-color is non-existent / non-visible in the high contrast mode.

I was able to workaround this by doing the following css hack:

element.style {
    "@media (forced-colors: active)": {
        background-color: "Highlight",
        forced-color-adjust: "none",
        color: "HighlightText",
      },
}

Output:
Image

Expected Behavior

We're wondering what is the official statement from Fluent team on this component's appearance for high contrast displays - can you perhaps take a look and come up with an official response and/or solution, so that the Tree component behaves as expected, in both normal and high contrast modes?

Reproduction

https://react.fluentui.dev/?path=/docs/components-tree--docs#appearance

Steps to reproduce

  1. Go to the Appearance tab in the Tree component docs.
  2. Observe the :hover css styling being applied, when you hover over a tree item.
  3. Change display to high contrast.
  4. Observe the :hover css styling not making a visual difference to the tree item.

Are you reporting an Accessibility issue?

yes

Suggested severity

High - No workaround

Products/sites affected

people-app

Are you willing to submit a PR to fix?

yes

Validations

  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • The provided reproduction is a minimal reproducible example of the bug.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions