USWDS - Normalize: Remove outdated normalizations#5555
Conversation
There was a problem hiding this comment.
LGTM — thanks for adding the license info!
Browsers tested
- Chromium 120
- Firefox 122
- Safari 17.1.2
I also created a test branch [test-aduth-modern-normalize] on uswds/uswds-site and found no issues in Accordion or Banner (tested because they rely on hidden).
This update saves 2KB on CSS, 6KB → 4KB.
mahoneycm
left a comment
There was a problem hiding this comment.
This looks good to me! Just one question left on a changed line.
Note
I had to pull the latest changes from develop to resolve some visual discrepancies that have been previously addressed.
- No build errors
- No visual regressions perceived on changed elements
- Visual display consistent across browsers
amyleadem
left a comment
There was a problem hiding this comment.
I tested this in Firefox, Safari, and Chromium and didn't see any regressions for the changed elements.
I wanted to flag that I found one small difference in appearance in <hr> elements in Firefox after this change, but I don't think it should be considered a blocker. I've added details in the comment below.
|
Really appreciate all the work done here. We've put a hold on this PR for now, but we're going to look at how we can include this and other opt out features in an upcoming release. For now, I've moved it to the 3.9.0 release milestone. |
mejiaj
left a comment
There was a problem hiding this comment.
Thanks for submitting this.
I've created a test branch on site so we can test for any regressions.
Measured the file sizes and documenting that I see the CSS is going from 677 → 676 KB.
Minor thought on giving credit in the normalize file, but don't see it as a blocker.
| @@ -1,5 +1,3 @@ | |||
| /*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */ | |||
There was a problem hiding this comment.
thought: Perhaps we should give credit normalize files used here.
Summary
Update normalize styles to remove outdated normalizations. Reduces the compiled size of normalization styles.
Related issue
Closes #4701
Problem statement
As a developer, I expect that USWDS applies its stated browser support to source code, so that I'm not misled by unexpected behaviors, or unnecessarily inflating the size of my compiled artifacts for end-users.
As an end-user, I expect that sites using USWDS load quickly, so that I'm not stuck waiting for pages to load in order to access the content I'm seeking.
Solution
The solution here refines the existing normalize stylesheet to prune styles which are not needed, either due to improvements in the affected browsers, or due to the browser no longer being supported (e.g. Internet Explorer). These refinements were applied manually, using the following projects as references:
An alternative / future-proof solution could consider incorporating something like PostCSS Normalize, which aims to automatically prune styles from the base normalization script using a project's own browserslist configuration.