Page MenuHomePhabricator

Consider increasing the contrast ratio of disabled elements
Closed, ResolvedPublic1 Estimated Story Points

Description

Background

Although minimum contrast is not required on disabled elements, the following system elements could be more contrasted since now they are just 1.61:1:

  • Disabled buttons
  • Disabled FilterChip
  • Disabled selected Checkbox
  • Disabled selected Radio

Proposal

At the moment we are using content-inverted #fff for disabled text/icon. There are a few different options which could be used instead. The design of these options can be found in Figma. The design proposal after rounds of design review and feedback can be found below.

op2.png (1×636 px, 89 KB)

Design spec

Open questions

From WCAG guidelines, which have changed in the past on how to deal with disabled components, we've come to reach out about this specific question to AFB in T355337 and gathered this feedback:

To have a contrast ratio of at least 3:1 [not as strict requirement, but as best practice]

Decisions

  • Through some rounds of design feedback, we have determined that it is not necessarily more contrast that is needed for disabled elements, but more clarity that an element is disabled and difference from enabled elements. This results in some lighter disabled styles.
  • Disabled elements should be using -disabled tokens.
  • Disabled styles across interactive elements, especially form items, should be made to have consistent styles and states.
  • Generally, when it comes to disabled actions such as buttons, we should discourage use and instead encourage the use of validation (as listed in our guidelines on constructing forms), except where the action is reliant on a single action, such as adding a citation. For disabled inputs, these should be disabled because they are not meant to be legible since they are unavailable as a selection/input.
Expected changes

Application.json

Token namenew, update, or remove?beforeafter
background-color-disabledupdategray300gray200
color-disabledupdategray500gray400
color-disabled-emphasizednew-gray400

Dark.json

Token namenew, update, or remove?beforeafter
background-color-disabledupdategray600gray700
background-color-disabled-subtleupdategray700gray800
color-disablednew-gray600
color-disabled-emphasizednew-gray500

Acceptance criteria (or Done)

Design

  • Design the Figma spec sheet and add it in this task
  • Update the tokens and styles within components in Figma

Code

  • Update the tokens and styles within components in Code

Event Timeline

Volker_E updated the task description. (Show Details)
CCiufo-WMF renamed this task from Disabled elements: evaluate if we want to increase the contrast ratio to Consider increasing the contrast ratio of disabled elements.Jul 31 2024, 8:03 PM
CCiufo-WMF raised the priority of this task from Low to Needs Triage.

Change #1082070 had a related patch set uploaded (by Dtorsani; author: Dtorsani):

[design/codex@main] tokens: Update disabled tokens

https://gerrit.wikimedia.org/r/1082070

I posted a comment in Gerrit but I want to express it here a well for visibility.

I'm not sure we should move forward with this change as it currently stands. I don't think that it makes disabled buttons easier to read or to identify as disabled.

The white text on #c8ccd1 background was low-contrast at 1.61, but I think that making the text as light as possible on the grey background helped for legibility. Plus disabled buttons were obviously disabled.

The guidelines here specify a text color of #72777d on a background of c8ccd1 – this is a contrast ratio of 2.8; in theory this is better but in practice I think it will make it harder for users to differentiate between disabled and no-disabled buttons.

In the latest version of the linked patch, a different set of colors are actually being used however – the text is set to #a2a9b1 and the background is #dadde3. This only provides a contrast ratio of 1.74 (so not much different from what we have now), and I actually find the grey-on-grey text more difficult to read than the white-on-grey style we have currently, regardless of the numerical ratio.

Thanks @egardner. I will copy my response from the Gerrit patch as well.

Please review the updated task with the design proposal and decisions. Apologies for not having updated this sooner. When it comes to legibility of the text, we are either choosing to meet WCAG criteria or not. There's not really an in between. The design team determined it is more important that an element appears more disabled than enabled or slightly legible for some people.

Through rounds of design review and feedback, we landed on the decisions listed in the task above.

@DTorsani-WMF I've reviewed the patch with the disabled states updates and it looks good to me. I agree on using the disabled color tokens for the text and the contrast now is increased from 1.61:1 to 2.01:1.

@DTorsani-WMF thanks for updating the task here. I agree that clearly indicating that a button is disabled is more important than ensuring that a certain contrast threshold is met.

@DTorsani-WMF I've reviewed the patch with the disabled states updates and it looks good to me. I agree on using the disabled color tokens for the text and the contrast now is increased from 1.61:1 to 2.01:1.

@bmartinezcalvo are we looking at the same disabled button styles? What I see in this patch only has a ratio of 1,74 (which is similar enough to what we had previously that I questioned the usefulness of this change). I'm seeing a value of #A2A9B1 for the foreground color and #DADDE3 for the background color.

Screenshot 2024-10-28 at 9.16.01 AM.png (1×1 px, 178 KB)

Screenshot 2024-10-28 at 9.19.02 AM.png (478×1 px, 47 KB)

Change #1082070 merged by jenkins-bot:

[design/codex@main] tokens: Update disabled tokens and add color-disabled-emphasized

https://gerrit.wikimedia.org/r/1082070

Test wiki created on Patch demo by ATomasevich (WMF) using patch(es) linked to this task:
http://patchdemo.wmcloud.org/wikis/a5d0a31f72/w/

Test wiki on Patch demo by ATomasevich (WMF) using patch(es) linked to this task was deleted:

http://patchdemo.wmcloud.org/wikis/a5d0a31f72/w/