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

Off state of toggle (and small toggle) lacks 3:1 contrast with adjacent color (background) #3614

Closed
mbgower opened this issue Jul 31, 2019 · 4 comments · Fixed by #4038
Closed
Assignees
Labels
package: react carbon-components-react type: a11y ♿

Comments

@mbgower
Copy link

mbgower commented Jul 31, 2019

Off state of toggle lacks 3:1 contrast with adjacent color ( either internal circle or background)

-->

Environment

v10, react, theme

Operating system
Windows 7

Browser
Firefox and Chrome

Detailed description

There are different implementations of the toggle, but all fail contrast for the 'off' state.

What did you expect to happen?
The off state should meet the minimum contrast.

What WCAG 2.1 checkpoint does the issue violate?
Non-text Contrast

Steps to reproduce the issue

  1. Step one
  2. Step two
  3. Step three
  4. etc.

Please create a reduced test case in CodeSandbox

Additional information

image
Storybook Toggle on (sufficient)
image
Storybook Toggle off (insuficient 2.5:1 between oval and lighter gray of circle)
image
Theme on and off toggle (same failure ratio as first screen shot)
image
V10 showing on and insufficient off toggle ( contrast for 1.8:1)
image
v10 Toggle small, with similar challenges for the 'off' toggle

Notes

In a situation where ALL the toggle versions contained a visible text state (On/Off) the non-text contrast could likely be excused since the visual cue would be redundant to the text and thus not required ("Visual information required to identify user interface components and states...)
That is, with a text state of "off" visible, the user no longer needs to discern the state of the toggle. However, this is a fairly easy issue to resolve -- just ensure the toggle border is 3:1 against the white background (for the v10 version) and that the circle is a lighter gray (or white) so that it is visible.

@asudoh
Copy link
Contributor

asudoh commented Jul 31, 2019

CC @carbon-design-system/design just to see if the team has had a discussion on this topic.

@snidersd snidersd added the package: react carbon-components-react label Aug 5, 2019
@dakahn dakahn added this to the IBMa Carbon Copy milestone Aug 7, 2019
@aledavila aledavila self-assigned this Sep 5, 2019
@shixiedesign
Copy link
Contributor

Waaaaait I know this issue must be fixed this sprint but y’all don’t know which colors are accessible yet with the new color palette getting implemented. Hang on till tomorrow.

@shixiedesign
Copy link
Contributor

shixiedesign commented Sep 11, 2019

Toggle final spec (updated according to Anna's comment below)

Please note:

  • Hover state should look the same as default.
  • Disabled state has no change.
// on state

pill: $support-02
circle: $icon-03

// off state

pill: $ui-04
cirlce: $icon-03

image

Focus styling update

Additional change is adding a white inside border to focus state, so the focus border is 3:1 accessible against component & background. Reference the same treatment in primary button.

image

@aagonzales
Copy link
Member

aagonzales commented Sep 11, 2019

No hover

I don't think it should have a hover. Most toggles ive seen in the wild don't have a hover. Also similar control in Carbon, like check box and radio, don't have hovers

Focus

Agreed, I like the focus options you chose.

asudoh pushed a commit to asudoh/carbon-components that referenced this issue Sep 19, 2019
shixiedesign pushed a commit that referenced this issue Sep 20, 2019
* fix(toggle): update colors

Fixes #3614.

* chore(toggle): add explanation of base box-shadow
@dakahn dakahn modified the milestones: IBMa Carbon Copy, ♿Carbon WCAG Compliance♿ Nov 21, 2019
@mattrosno mattrosno removed this from the ♿Carbon WCAG Compliance♿ milestone Dec 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: react carbon-components-react type: a11y ♿
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants