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

Fix low color contrast issues across several widgets #1282

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

Myranae
Copy link
Contributor

@Myranae Myranae commented May 16, 2024

Summary:

Worked on as part of GAAD.
The issue here was specific to the low contrast found for the dot and line in number-line. This fix changes the KhanColors object in Perseus which is used across a number of widgets. The changes here specifically affect grapher, number-line, interaction, and interactive-graph (based on the updated snapshots).

Discussion about what colors to use. Includes input from a designer

Before:
image
image
image

After:
image
image
image

Here's also some manual testing of how it looks in webapp (test everything course). Checked the other three types of graphs also affected by this as well.

Before:
image

After:
image

Issue: LEMS-252

Test plan:

  • Check all the widgets that were affected in Storybook and confirm the colors have at least 3:1 contrast with surroundings
  • Also confirm the designs are not negatively affected
  • Confirm all checks pass

@Myranae Myranae self-assigned this May 16, 2024
@Myranae Myranae changed the title Fix low contrast issues across several widgets Concept: Fix low contrast issues across several widgets May 16, 2024
Copy link
Contributor

github-actions bot commented May 16, 2024

Size Change: -166 B (-0.02%)

Total Size: 843 kB

Filename Size Change
packages/perseus/dist/es/index.js 405 kB -166 B (-0.04%)
ℹ️ View Unchanged
Filename Size
packages/kas/dist/es/index.js 38.2 kB
packages/kmath/dist/es/index.js 4.26 kB
packages/math-input/dist/es/index.js 80.1 kB
packages/math-input/dist/es/strings.js 1.73 kB
packages/perseus-core/dist/es/index.js 906 B
packages/perseus-editor/dist/es/index.js 271 kB
packages/perseus-error/dist/es/index.js 866 B
packages/perseus-linter/dist/es/index.js 21.8 kB
packages/perseus/dist/es/strings.js 3.21 kB
packages/pure-markdown/dist/es/index.js 3.67 kB
packages/simple-markdown/dist/es/index.js 12.4 kB

compressed-size-action

Copy link

codecov bot commented May 16, 2024

Codecov Report

Attention: Patch coverage is 72.22222% with 5 lines in your changes missing coverage. Please review.

Project coverage is 71.22%. Comparing base (428d6f4) to head (6d5cd30).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1282      +/-   ##
==========================================
+ Coverage   69.59%   71.22%   +1.62%     
==========================================
  Files         485      489       +4     
  Lines      102927   102997      +70     
  Branches     7376    11132    +3756     
==========================================
+ Hits        71633    73357    +1724     
+ Misses      31178    29640    -1538     
+ Partials      116        0     -116     

Impacted file tree graph

Files Coverage Δ
packages/perseus/src/util/colors.ts 100.00% <100.00%> (ø)
packages/perseus/src/widgets/number-line.tsx 58.48% <54.54%> (+0.46%) ⬆️

... and 121 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 428d6f4...6d5cd30. Read the comment docs.

@Myranae Myranae changed the title Concept: Fix low contrast issues across several widgets Fix low color contrast issues across several widgets Jun 5, 2024
Comment on lines +86 to +87
INTERACTING: color.green,
INTERACTIVE: color.green,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could also just combine these into one since they are both the same color. Thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd be down for that! How many changes would that add to this PR? Or does it have wider consequences?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, there are 45 instances of INTERACTIVE and 26 instances of INTERACTING all across 13 files. I would probably make INTERACTING just be INTERACTIVE, so it would only add 5 files with changes.

I don't think it would have wider consequences since both are using the same color, though I don't know if the change in meaning would be troublesome.

Perhaps this should be part of a wider change of updating KhanColors at some point and saved for another time since it has so many instances. I think I assumed it would be a smaller change. 😅

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah in that case I would hold off and just submit a backlog task to revisit in the future 😉

// Don't actually use _BACKGROUND! Make things transparent instead. The
// background color used in exercises is subject to change at the whim
// of any redesigns.
_BACKGROUND: "#FDFDFD", // TODO(eater): Get rid of this altogether.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got rid of this part since both comments seem to think it is not needed. Replaced where they are used with just "transparent".

@Myranae Myranae marked this pull request as ready for review June 5, 2024 20:30
@khan-actions-bot
Copy link
Contributor

Gerald

Required Reviewers
  • @Khan/perseus for changes to .changeset/twenty-bananas-joke.md, packages/perseus/src/interactive2/movable-point.test.ts, packages/perseus/src/util/colors.ts, packages/perseus/src/widgets/number-line.tsx, packages/perseus/src/widgets/__tests__/__snapshots__/grapher.test.ts.snap, packages/perseus/src/widgets/__tests__/__snapshots__/interaction.test.ts.snap, packages/perseus/src/widgets/__tests__/__snapshots__/interactive-graph.test.ts.snap, packages/perseus/src/widgets/__tests__/__snapshots__/number-line.test.ts.snap

Don't want to be involved in this pull request? Comment #removeme and we won't notify you of further changes.

@catandthemachines
Copy link
Contributor

Do you have screen shots of the UX changes with the new colors? :)

@catandthemachines
Copy link
Contributor

Were you able to run an accessibility scan and confirm the color doesn't have any more issues?

@catandthemachines
Copy link
Contributor

Not sure how it works here just yet, but were you able to confirm or check with a designer on these new colors?

@Myranae
Copy link
Contributor Author

Myranae commented Jun 6, 2024

Do you have screen shots of the UX changes with the new colors? :)

Ooo, thank you @catandthemachines! Will get these added :D

@Myranae
Copy link
Contributor Author

Myranae commented Jun 6, 2024

Were you able to run an accessibility scan and confirm the color doesn't have any more issues?

@catandthemachines Hmm, I'm not sure about an accessibility scan. How would I do that and what other issues are possible? I did triple check the ratio was better. I noticed the ratio between the lines and the dots might not be ideal, but not sure if that is fixable since the dot color has to have good contrast with the background (and so does the line).

Copy link
Contributor

github-actions bot commented Jun 6, 2024

npm Snapshot: Published

Good news!! We've packaged up the latest commit from this PR (6d5cd30) and published it to npm. You
can install it using the tag PR1282.

Example:

yarn add @khanacademy/perseus@PR1282

If you are working in Khan Academy's webapp, you can run:

./dev/tools/bump_perseus_version.sh -t PR1282

@Myranae
Copy link
Contributor Author

Myranae commented Jun 6, 2024

Not sure how it works here just yet, but were you able to confirm or check with a designer on these new colors?

@catandthemachines I added a link to the PR summary that leads to the conversation I had with the team and a designer about what colors to use. Planning to make a ZND and check with our QE person on the change as well. (Before merging but after things slow down a bit).

@catandthemachines
Copy link
Contributor

Were you able to run an accessibility scan and confirm the color doesn't have any more issues?

@catandthemachines Hmm, I'm not sure about an accessibility scan. How would I do that and what other issues are possible? I did triple check the ratio was better. I noticed the ratio between the lines and the dots might not be ideal, but not sure if that is fixable since the dot color has to have good contrast with the background (and so does the line).

There are a lot of great accessibility scan tools for Chrome browsers (I use Accessibility Insights when I want to confirm is my site has any issues or not https://chromewebstore.google.com/detail/accessibility-insights-fo/pbjjkligggfmakdaogkfomddhfmpjeni ). For the question on the dot vs. the line, that might be a great question for Level Access to give us suggestions. I can't remember off the top of my head but I believe distinguishing content in a visual diagram has different color contrast requirements than text vs. background.

Comment on lines +86 to +87
INTERACTING: color.green,
INTERACTIVE: color.green,
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd be down for that! How many changes would that add to this PR? Or does it have wider consequences?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants