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: avoid infinite while loop with colorYiq #2349

Merged
merged 2 commits into from
Jun 3, 2023

Conversation

adamstankiewicz
Copy link
Member

Description

Running the updated colorYiq function that tries to automatically darken/brighten color tokens if they do not pass background/foreground color contrast ratio of 4.5:1 for a11y hits an infinite loop if the colors can never meet a 4.5:1 contrast ratio.

This PR ensures we only try to brighten/darken tokens a max of 10 times to avoid an infinite loop. Consoles a warning with the design token name when it couldn't brighten/darken tokens sufficiently to pass a 4.5:1 contrast ratio.

Deploy Preview

N/A

Merge Checklist

  • If your update includes visual changes, have they been reviewed by a designer? Send them a link to the Netlify deploy preview, if applicable.
  • Does your change adhere to the documented style conventions?
  • Do any prop types have missing descriptions in the Props API tables in the documentation site (check deploy preview)?
  • Were your changes tested using all available themes (see theme switcher in the header of the deploy preview, under the "Settings" icon)?
  • Were your changes tested in the example app?
  • Is there adequate test coverage for your changes?
  • Consider whether this change needs to reviewed/QA'ed for accessibility (a11y). If so, please add wittjeff and adamstankiewicz as reviewers on this PR.

Post-merge Checklist

  • Verify your changes were released to NPM at the expected version.
  • If you'd like, share your contribution in #show-and-tell.
  • 🎉 🙌 Celebrate! Thanks for your contribution.

@adamstankiewicz adamstankiewicz force-pushed the ags/yiq-auto-darken-brighten-until-a11y branch from 6a8b5a6 to d9144cb Compare June 3, 2023 13:35
@codecov
Copy link

codecov bot commented Jun 3, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (9fa8190) 91.58% compared to head (87440f5) 91.58%.

Additional details and impacted files
@@           Coverage Diff           @@
##            alpha    #2349   +/-   ##
=======================================
  Coverage   91.58%   91.58%           
=======================================
  Files         214      214           
  Lines        3519     3519           
  Branches      852      852           
=======================================
  Hits         3223     3223           
  Misses        288      288           
  Partials        8        8           

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@adamstankiewicz adamstankiewicz merged commit 101fe25 into alpha Jun 3, 2023
@adamstankiewicz adamstankiewicz deleted the ags/yiq-auto-darken-brighten-until-a11y branch June 3, 2023 14:17
@edx-semantic-release
Copy link
Contributor

🎉 This PR is included in version 21.0.0-alpha.32 🎉

The release is available on:

Your semantic-release bot 📦🚀

monteri pushed a commit to raccoongang/paragon that referenced this pull request Aug 17, 2023
* fix: avoid never ending while loop with colorYiq
* fix: replace scss variable with css variable
PKulkoRaccoonGang pushed a commit to raccoongang/paragon that referenced this pull request Aug 18, 2023
* fix: avoid never ending while loop with colorYiq
* fix: replace scss variable with css variable
@edx-semantic-release
Copy link
Contributor

🎉 This PR is included in version 22.0.0-alpha.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@openedx-semantic-release-bot

🎉 This PR is included in version 23.0.0-alpha.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

PKulkoRaccoonGang pushed a commit that referenced this pull request Aug 1, 2024
* fix: avoid never ending while loop with colorYiq
* fix: replace scss variable with css variable
PKulkoRaccoonGang pushed a commit that referenced this pull request Aug 4, 2024
* fix: avoid never ending while loop with colorYiq
* fix: replace scss variable with css variable
PKulkoRaccoonGang pushed a commit that referenced this pull request Aug 4, 2024
* fix: avoid never ending while loop with colorYiq
* fix: replace scss variable with css variable
PKulkoRaccoonGang pushed a commit that referenced this pull request Aug 5, 2024
* fix: avoid never ending while loop with colorYiq
* fix: replace scss variable with css variable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants