Skip to content

Comments

Avoid loading Tab Navigation component stylesheet dependencies#8572

Merged
aduth merged 1 commit intomainfrom
aduth-tab-navigation-dependency-styles
Jun 9, 2023
Merged

Avoid loading Tab Navigation component stylesheet dependencies#8572
aduth merged 1 commit intomainfrom
aduth-tab-navigation-dependency-styles

Conversation

@aduth
Copy link
Contributor

@aduth aduth commented Jun 9, 2023

🎫 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.css

Before: 1.99kb
After: 0.62kb
Diff: -1.37kb (-68.8%)

📜 Testing Plan

  1. Run yarn build:css
  2. Open app/assets/builds/tab_navigation_component.css
  3. Observe that you don't see any .usa-button styles

changelog: User-Facing Improvements, Sign In, Update layout of Sign In page to reflect results of recent A/B test
@aduth aduth merged commit 4b49008 into main Jun 9, 2023
@aduth aduth deleted the aduth-tab-navigation-dependency-styles branch June 9, 2023 19:41
@jmhooper jmhooper mentioned this pull request Jun 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants