USWDS - Card: Fix $theme-card-padding-y calculations#5571
Merged
thisisdano merged 1 commit intodevelopfrom Nov 2, 2023
Merged
Conversation
mahoneycm
approved these changes
Oct 26, 2023
Contributor
mahoneycm
left a comment
There was a problem hiding this comment.
Looks good to me!
Checklist
- Confirm that the
$theme-card-padding-ysetting accepts all listed padding token values without error: 1px, 2px, 05, 1, 105, 2, 205, 3, 4, 5, 6, 7, 8, 9, 10, 15, 0. - Confirm that all math performed on
$theme-card-padding-yare not used in mixins. - Confirm that the setting updates the visual presentation as expected.
- Confirm that there are no visual regressions.
This was referenced Oct 27, 2023
thisisdano
approved these changes
Nov 2, 2023
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixed a bug that prevented
$theme-card-padding-yfrom accepting expected token values.Breaking change
This is not a breaking change.
Related issue
Closes #5515
Related pull requests
Changelog PR
Preview link
Card component
Problem statement
When setting custom values for
$theme-card-padding-y, some values that the system says are acceptable cause an error.For example:
$theme-card-padding-y: 15results in the following error:This problem occurs because the
u-paddingmixins accept only known unit tokens. The current calculations perform division on the setting value before running it through the mixin, which means that the mixins are not always receiving acceptable unit values. For example, when$theme-card-padding-yis defined with 15, the mixin receives the value of 7.5, which is not a mapped unit value.Solution
When the padding value must be divided, we should not use
u-paddingmixins and instead directly define the CSS padding property.Testing and review
$theme-card-padding-ysetting accepts all listed padding token values without error: 1px, 2px, 05, 1, 105, 2, 205, 3, 4, 5, 6, 7, 8, 9, 10, 15, 0.$theme-card-padding-yare not used in mixins.