Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fluent v2 Inherited Text Foreground is Incorrect in ListView for TextBox/DatePicker/etc. #6469

Closed
1 of 2 tasks
robloo opened this issue Dec 12, 2021 · 3 comments
Closed
1 of 2 tasks
Labels
area-UIDesign UI Design, styling team-Controls Issue for the Controls team

Comments

@robloo
Copy link
Contributor

robloo commented Dec 12, 2021

Describe the bug

This is a design bug with the new Fluent v2 styles -- primarily the dark theme. It is not a technical issue.

With the old Fluent v1 and earlier styles, the ListViewItem selection background color was not so different from non-selected item backgrounds. In practice this means the text Foreground brush doesn't need to change if an item is selected or not. However, in Fluent v2, selected backgrounds are now significantly different from non-selected which requires inverting the text Foreground color. This works up until you until you have an input/editing control. Input controls like TextBox override the inherited Foreground color.

Fluent v1: (no issue)

image

Fluent v2: (issue)

image

With Fluent v2 in dark theme, selected ListViewItems violate the accessibility contrast requirements (set by Windows). It is hard to see regardless of the requirements themselves.

Steps to reproduce the bug

Within a ListView simply place TextBoxes or DatePicker controls as content. You will notice that the default text Foreground colors do not work if the ListViewItem is selected.

Repro App:
App1.zip

Expected behavior

In older styles the Text foreground never needs to change. With the newer styles, editing controls must manually break the foreground brush inheritance when they are selected to avoid issues. This is not always convenient or intuitive.

Bottom line I want to know the recommended solutions Microsoft has for this issue. There needs to be something simple. I'm guessing it was missed during Fluent v2 style development. That said, I've seen styles such as the below which solve this issue but don't seem to have been released or set as the default:

Screenshots

Issue:

image

No Issue:

image

NuGet package version

No response

Windows app type

  • UWP
  • Win32

Device form factor

Desktop

Windows version

May 2021 Update (19043)

Additional context

No response

@ghost ghost added the needs-triage Issue needs to be triaged by the area owners label Dec 12, 2021
@robloo robloo closed this as completed Dec 12, 2021
@ghost ghost removed the needs-triage Issue needs to be triaged by the area owners label Dec 12, 2021
@robloo robloo reopened this Dec 18, 2021
@ghost ghost added the needs-triage Issue needs to be triaged by the area owners label Dec 18, 2021
@StephenLPeters StephenLPeters added team-Controls Issue for the Controls team area-UIDesign UI Design, styling and removed needs-triage Issue needs to be triaged by the area owners labels Mar 1, 2022
@StephenLPeters
Copy link
Contributor

@chigy FYI

@robloo
Copy link
Contributor Author

robloo commented Mar 19, 2022

@chigy @StephenLPeters My recommendation is to add another Secondardy/Alternate ListViewItem style that supports the gray background and selection pill design used in the ComboBox. That would allow apps to quickly switch to a container style that doesn't have this issue.

@robloo
Copy link
Contributor Author

robloo commented Jul 19, 2023

I'm closing this as apps are moving to Fluent v2 / Windows 11 styling in listboxes for the most part. That sidesteps this issue with the older styles.

That said, the newer listbox/listboxitem styles really should have been copied over to this WinUI library repo around the Fluent v2 timeframe. Don't know why it's mismatched in this area.

@robloo robloo closed this as completed Jul 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-UIDesign UI Design, styling team-Controls Issue for the Controls team
Projects
None yet
Development

No branches or pull requests

2 participants