Repository navigation
Conversation
mahoneycm
marked this pull request as ready for review
January 30, 2024 18:44
4 tasks
:where() on all grid layout classes defined component styles
5 tasks done
Contributor
|
@mahoneycm we discussed this in 02/06 Dev sync - Release check-in 🔒 (only GSA emails). We're going with the other solution because, while more verbose, the browser support is better than |
Contributor
Author
|
Closing in favor of #5675 based on Dev Sync discussion |
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
Resolves style specificity issues between
usa-footerandusa-grid-layout. This resolves visual regressions potentially caused by #5289.Breaking change
This is not a breaking change.
Related issue
Closes #5676
Changelog → pending
Related pull requests
Grid dependency removed in #5289
Preview link
Footer →
Demo repo →
Demo footer →
Warning
By default, the test repo and preview are using
3.7.1. To see fix in affect, install this branch as USWDSnpm install @uswds/uswds "https://github.com/uswds/uswds/tree/cm-footer-grid-where-hotfix" --saveProblem statement
Layout grid styles defined in footer have higher specificity than other layout-grid styles. As a result, updated layout grid utility classes in footer markup do not affect layout as expected.
Solution
Use
:where()to negate specificity in nested grid classes.Testing and review
The demo repo below showcases how footer-defined grid styles have specificity over standard grid classes when both are imported to a project and then instructs the user to install this branch to resolve the issue.
3.7.1footerandgrid-layout<li>style changesnpm install @uswds/uswds "https://github.com/uswds/uswds/tree/cm-footer-grid-where-hotfix" --saveTesting checklist
_usa-footer.scss$theme-layout-grid-use-important: trueis not required for desired layout-grid styles:where()is needed on each grid classFurther consideration
I tested some of the options offered by sass:meta to test for the inclusion of the layout grid package. Since the grid classes are always included in our sass package, I was unable to use the functions to check for the existence of layout grid (They always return true).
We should consider if there are other ways to check for the inclusion of the package on the project level.
From @mejiaj in #5675