Skip to content

[MOOSE-401] Round theme clamp values to nearest 2px#358

Merged
GeoffDusome merged 6 commits into
mainfrom
feature/MOOSE-401/round-clamp-values
May 29, 2026
Merged

[MOOSE-401] Round theme clamp values to nearest 2px#358
GeoffDusome merged 6 commits into
mainfrom
feature/MOOSE-401/round-clamp-values

Conversation

@GeoffDusome
Copy link
Copy Markdown
Contributor

@GeoffDusome GeoffDusome commented May 22, 2026

What does this do/fix?

Wraps each theme clamp() with round(down, clamp(…), 2px) so the computed fluid value snaps down to a predictable 2px grid. Applies to fluid font sizes, spacing presets, and grid gutter/margin in theme.json, plus matching fallbacks in layout/_variables.pcss.

A 2px step avoids coarse jumps on smaller clamp ranges where a 4px interval might barely change between breakpoints.

References: Better fluid sizing with round()

QA

Links to relevant issues

Test Environment

Test plan

  • Load the site/editor in a browser that supports CSS round() (Chrome/Edge/Firefox/Safari, baseline 2024+).
  • Resize the viewport between mobile and desktop; inspect computed font sizes and spacing presets in DevTools — values should land on multiples of 2px (e.g. 14px, 16px, 18px), not fractional pixels like 19.7px.
  • Confirm smaller presets (e.g. font-size 10, spacing 10) still step visibly while resizing, not stuck on one value across the whole range.
  • Confirm grid gutter/margin (--wp--custom--spacing--grid-gutter, --wp--custom--spacing--grid-margin) still scale fluidly and align with layout expectations.
  • Smoke-check typography presets (font-size 10–90) and spacing presets (10–70) on a page using those tokens.
  • Verify no layout regressions on key templates (home, interior page with wide/full blocks).

Screenshots/video:

Pull request checklist

  • I've added a changelog entry for these changes.
  • I've linked to a relevant Jira issue.
  • I've captured a screenshot or screencast of the changes and linked it above.

GeoffDusome and others added 3 commits May 22, 2026 13:37
Wrap each clamp() min/preferred/max argument with round(down, …, 4px) so fluid spacing and typography snap to a predictable 4px grid at runtime.

Co-authored-by: Cursor <cursoragent@cursor.com>
…per-arg

Apply round(down, clamp(...), 4px) so the computed clamp result snaps to 4px, matching the intended CSS round() usage.

Co-authored-by: Cursor <cursoragent@cursor.com>
…lues

Smaller step keeps subtle clamp ranges on a predictable grid without overshooting on small token sizes.

Co-authored-by: Cursor <cursoragent@cursor.com>
@GeoffDusome GeoffDusome changed the title [MOOSE-401] Round theme clamp values to nearest 4px [MOOSE-401] Round theme clamp values to nearest 2px May 22, 2026
@GeoffDusome GeoffDusome self-assigned this May 22, 2026
Copy link
Copy Markdown
Contributor

@jamiepaul jamiepaul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 neat!

Copy link
Copy Markdown
Collaborator

@dpellenwood dpellenwood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢

@GeoffDusome GeoffDusome merged commit 24eaa20 into main May 29, 2026
7 checks passed
@GeoffDusome GeoffDusome deleted the feature/MOOSE-401/round-clamp-values branch May 29, 2026 20:57
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.

3 participants