Skip to content

Fix off-scale spacing values flagged in #42907 - #42911

Closed
bobby404-K wants to merge 1 commit into
twbs:mainfrom
bobby404-K:fix/spacing-scale-audit-42907
Closed

Fix off-scale spacing values flagged in #42907#42911
bobby404-K wants to merge 1 commit into
twbs:mainfrom
bobby404-K:fix/spacing-scale-audit-42907

Conversation

@bobby404-K

@bobby404-K bobby404-K commented Sep 7, 2026

Copy link
Copy Markdown

Docs site (site/src/scss/*.scss): snapped literal spacing values (.125rem, .75rem, 1.25rem, 2rem, 15px) to the nearest step on the inferred scale (0, .25rem, .5rem, 1rem, 1.5rem, 3rem). These are cosmetic/unshipped so resizing is low risk.

Core library (scss/_variables.scss, scss/_reboot.scss): .75rem and .125rem recur consistently across unrelated components (button, navbar-toggler, pagination, and toast padding-x; form-check margin and dropdown offset), which reads as intentional undocumented tokens rather than drift. Resizing these would visibly change shipped component appearance for every Bootstrap consumer, so instead they're formalized as named variables derived from $spacer ($spacer-tight, $spacer-hairline) with no visual change. Same treatment for the single 2rem list-indent literal in _reboot.scss (-> $list-indent).

Verified: both scss/bootstrap.scss and site/src/scss/docs.scss compile cleanly with dart-sass.

Description

Motivation & Context

Type of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (non-breaking change)
  • Breaking change (fix or feature that would change existing functionality)

Checklist

  • I have read the contributing guidelines
  • My code follows the code style of the project (using npm run lint)
  • My change introduces changes to the documentation
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed

Live previews

Related issues

@bobby404-K
bobby404-K requested a review from a team as a code owner September 7, 2026 14:48
Docs site (site/src/scss/*.scss): snapped literal spacing values
(.125rem, .75rem, 1.25rem, 2rem, 15px) to the nearest step on the
inferred scale (0, .25rem, .5rem, 1rem, 1.5rem, 3rem). These are
cosmetic/unshipped so resizing is low risk.

Core library (scss/_variables.scss, scss/_reboot.scss): .75rem and
.125rem recur consistently across unrelated components (button,
navbar-toggler, pagination, and toast padding-x; form-check margin
and dropdown offset), which reads as intentional undocumented
tokens rather than drift. Resizing these would visibly change
shipped component appearance for every Bootstrap consumer, so
instead they're formalized as named variables derived from $spacer
($spacer-tight, $spacer-hairline) with no visual change. Same
treatment for the single 2rem list-indent literal in _reboot.scss
(-> $list-indent).

Verified: both scss/bootstrap.scss and site/src/scss/docs.scss
compile cleanly with dart-sass.
@julien-deramond

Copy link
Copy Markdown
Member

Thanks for this PR but we won't change impacting things in scss/_reboot.scss and scss/_variables.scss for v5 (as the v6 alpha is landing soon). Same thing for the v5 docs.

@bobby404-K

Copy link
Copy Markdown
Author

Makes total sense, thanks for taking a look! Given v6 is close, I don't want to add noise to a version that's winding down.

Happy to close this out on my end — or if it'd be useful, I could look at whether the same off-scale values still show up on the v6 branch and open something there instead. Let me know whichever's more helpful, and no worries either way.

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.

Spacing scale audit: 53 literal spacing values off your own token scale

2 participants