Avoid loading Tab Navigation component stylesheet dependencies#8572
Merged
Avoid loading Tab Navigation component stylesheet dependencies#8572
Conversation
changelog: User-Facing Improvements, Sign In, Update layout of Sign In page to reflect results of recent A/B test
zachmargolis
approved these changes
Jun 9, 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.
🎫 Ticket
Related to LG-9973
🛠 Summary of changes
Updates the TabNavigationComponent stylesheet to avoid loading dependencies associated with the design system Button Group. Loading the bare identifier of a component will load all required dependencies. In the case of Button Group, this means that the Tab Navigation Component stylesheet is produced with all button styles (source), which are already present in the main application stylesheet (source). Since it should be assumed the button styles will be present anywhere the tab navigation component is used, avoid loading duplicated styles by referencing only the Button Group's own styles.
This is a supported usage pattern, documented by USWDS: https://designsystem.digital.gov/documentation/migration/#using-package-source
Technically this bypasses the Login.gov Design System's current override mechanism, but (a) the published version of LGDS does not have custom Button Group styles, and (b) this is being improved in 18F/identity-design-system#356 so that the revisions here would begin incorporating any LGDS customizations.
Performance Results
NODE_ENV=production yarn build:css && brotli-size app/assets/builds/tab_navigation_component.cssBefore: 1.99kb
After: 0.62kb
Diff: -1.37kb (-68.8%)
📜 Testing Plan
yarn build:cssapp/assets/builds/tab_navigation_component.css.usa-buttonstyles