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
Avoid unit math on settings until after configured unit resolved #5076
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! I was able to confirm the bug and the fix.
I also looked for other instances where we might be doing math inside of units, but didn't find any.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aduth Thanks for fixing this!
I was able to confirm the issue and that the updates here fix the problem. I also confirmed that there were no visual discrepancies in the affected areas for banner and alert.
I did notice one more instance of calculations happening inside units()
in usa-banner
: https://github.com/uswds/uswds/blob/develop/packages/usa-banner/src/styles/_usa-banner.scss#L187
Would you be able to update that as well?
Let me know if you have questions. Thanks again!
Hi @amyleadem , in that case is the variable
That being said, even if it's not configurable, I could see it being helpful to update it anyways for consistency. I'll push those changes shortly. |
Updated the banner unit math in 3d830f7 . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the quick response on this @aduth! Looks good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Summary
Attempts to fix #5075 by avoiding math on configurable settings values which could result in an invalid unit token. The effect should be the same, but ensures that the configurable unit value is resolved before attempting any math on it.
Related issue
Fixes #5075
Problem statement
Developers should be able to configure settings to any valid unit and the build should pass.
Solution
Resolves configured unit value before performing math on it.