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

W-14337923: Fix a11y color contrasts #1534

Merged
merged 5 commits into from
Nov 10, 2023
Merged

Conversation

alexvuong
Copy link
Collaborator

@alexvuong alexvuong commented Nov 9, 2023

Description

This PR fixes a11y color contrasts recommended in W-14337923

Major issues:

  • The contrast ratio of focus state color/background color not being satisfy the 3:1.
    Current focus state color of component is using chakra default variable: shadows.outline. See here.
    e.g:
    image

    • Solution: override the value in theme.shadows.outline in pwa-kit will fix all of this a11y issue. See here. This will fix 9 childrend issues
    • image
  • Search input background color against adjacent color.
    image

    • Solution: Add border that has a minimum of 3:1 contrast against both the white page background and the inner gray (off white) background of the input field.
  • One of the color filter in color refinement has insufficient contrast:

  • image

    • Solution: Add a border that has a contrast ratio of 3:1 or greater with the surrounding colors for all colors
      image
  • The gray outline for the 'This is a gift' checkbox has insufficient color contrast against adjacent colors
    image

    • Solution: change the checkbox border to a darker shade of grey to create higher contrast. Here we use gray.500
      image

Types of Changes

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Documentation update
  • Breaking change (could cause existing functionality to not work as expected)
  • Other changes (non-breaking changes that does not fit any of the above)

Breaking changes include:

  • Removing a public function or component or prop
  • Adding a required argument to a function
  • Changing the data type of a function parameter or return value
  • Adding a new peer dependency to package.json

Changes

  • (change1)

How to Test-Drive This PR

  • Check out code
  • Run Retail App
  • Confirm all the a11y issues in are resolved

Checklists

General

  • Changes are covered by test cases
  • CHANGELOG.md updated with a short description of changes (not required for documentation updates)

Accessibility Compliance

You must check off all items in one of the follow two lists:

  • There are no changes to UI

or...

Localization

  • Changes include a UI text update in the Retail React App (which requires translation)

@alexvuong alexvuong requested a review from a team as a code owner November 9, 2023 23:20
@@ -5,5 +5,6 @@
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
export default {
top: '0px -1px 3px rgba(0, 0, 0, 0.1), 0px -1px 2px rgba(0, 0, 0, 0.06)'
top: '0px -1px 3px rgba(0, 0, 0, 0.1), 0px -1px 2px rgba(0, 0, 0, 0.06)',
outline: '0 0 0 3px var(--chakra-colors-blue-500)'
Copy link
Collaborator Author

@alexvuong alexvuong Nov 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blue 500 is the minimum value of blue colors that satisfies the contrast ratio 3: 1 against #ffffff background
image

@@ -21,11 +21,17 @@ export default {
}
},
variants: {
outline: {
field: {
borderColor: 'gray.500'
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gray 500 is the minimum value of blue colors that satisfies the constrast ratio 3:1 against #ffffff background
image

wjhsf
wjhsf previously approved these changes Nov 10, 2023
Copy link
Collaborator

@joeluong-sfcc joeluong-sfcc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Search bar background fails contrast ratio against border color

Screenshot 2023-11-10 at 4 52 37 PM

Screenshot 2023-11-10 at 5 03 05 PM

@alexvuong alexvuong merged commit 2fc3d35 into develop Nov 10, 2023
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants