USWDS - Settings: Fix math errors with $theme-site-margins-width#5582
USWDS - Settings: Fix math errors with $theme-site-margins-width#5582thisisdano merged 1 commit intodevelopfrom
Conversation
mahoneycm
left a comment
There was a problem hiding this comment.
Lgtm! Left one small optional recommendation to keep the padding-x to a single line.
| padding-left: units($theme-site-margins-width) * 2; | ||
| padding-right: units($theme-site-margins-width) * 2; |
There was a problem hiding this comment.
Optional
We could replicate the u-padding-x functionality with the native padding-inline property
| padding-left: units($theme-site-margins-width) * 2; | |
| padding-right: units($theme-site-margins-width) * 2; | |
| padding-inline: units($theme-site-margins-width) * 2; |
There was a problem hiding this comment.
I avoided padding-inline here because it felt like it had meaning beyond what we intend at this time. I like the idea of moving towards padding-inline/padding-block in the future to better accommodate different language types, but in my mind it would require a comprehensive effort where we write styles for both block and inline. I might be overthinking it though! Curious to hear thoughts.
There was a problem hiding this comment.
I think that's a valid point! Not opposed to leaving it as is since it is more specifically defined.
There was a problem hiding this comment.
I'm happy to now know about these two new properties
There was a problem hiding this comment.
In this case it's the same value on each side, which at least makes it equivalent in LTR or RTL reading directions....


Summary
Fixed a bug that prevented
$theme-site-margins-widthfrom accepting expected token values.Breaking change
This is not a breaking change.
Related issue
Closes #5559
Related pull requests
Changelog PR
Preview link
Alert component
Problem statement
When setting custom values for
$theme-site-margins-width, some values that the system says are acceptable cause an error.For example,
$theme-site-margins-width: 6results in the following error:This happens because the
u-paddingmixins accept only known padding units. The current calculations perform multiplication 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-site-margins-widthis defined with 6, the mixin receives the value of 12, which is not a mapped unit value.Solution
paddingproperty rather than theu-paddingmixin allows the system to successfully do the required calculations.calc()enables the math to work when there are mixed units (For example, when$theme-site-margins-widthis set to1px).Testing and review
To test the alignment with default value for
$theme-site-margins-width:Open the alert component and confirm no visual regressions in alignment.
To test custom values for
$theme-site-margins-width:$theme-site-margins-widthto any of the following values: 1px, 2px, 05, 1, 105, 2, 205, 3, 4, 5, 6, 7, 8, 9, 10, 15, 0.