ref(scraps): Add dedicated container query breakpoint tokens#119804
ref(scraps): Add dedicated container query breakpoint tokens#119804priscilawebdev wants to merge 7 commits into
Conversation
Story previewsPreview the stories changed in this PR on the Vercel deployment:
Preview deployment: https://sentry-8w0ventt3.sentry.dev |
fae7d81 to
fe47ea9
Compare
fe47ea9 to
94c7ef3
Compare
94c7ef3 to
9e7d46c
Compare
Container queries and viewport media queries shared one scale (theme.breakpoints). Add a dedicated theme.containers scale with t-shirt-size names (zero, 3xs..5xl) for container queries, kept fully separate from the viewport breakpoints scale, following the Tailwind breakpoint/container split. Bare responsive keys resolve against theme.containers (@container); screen:-prefixed keys continue to resolve against theme.breakpoints (@media). Migrate existing bare-key consumers to preserve behavior.
9e7d46c to
983a202
Compare
Complete the 2xs->zero container-scale rename in Text's display resolver and its spec, fix stale @container assertions that pointed at theme.breakpoints instead of theme.containers, tighten rc()'s emit() typing so order/sizes key mismatches fail typecheck, and correct stale docs.
Split the Container Queries section into Container tokens and Screen tokens subsections with their own scale tables, lead with the preferred container axis, add a note on the preference, and trim dense prose.
|
bugbot run |
Resolve the bottom-vs-side sidebar flip against the layout's query container via useContainerBreakpoint instead of the viewport-based useMedia lg query, so sidebar placement stays in lockstep with groupDetailsLayout's 4xl container flip. Previously the two could disagree between the container-4xl (1152px) and viewport-lg (1200px) widths, leaving grid borders and the sidebar toggle out of sync with placement.
| // stays in lockstep with groupDetailsLayout's container-query flips — otherwise | ||
| // the sidebar placement and the grid/border layout can disagree at boundaries. | ||
| const containerBreakpoint = useContainerBreakpoint(); | ||
| const isBottomSidebar = !SIDE_SIDEBAR_BREAKPOINTS.has(containerBreakpoint); |
There was a problem hiding this comment.
Missing query container breaks sidebar
High Severity
useContainerBreakpoint() now drives issue-details sidebar placement, but GroupLayoutBody never sets containerType, so no ContainerQueryProvider wraps the layout. The hook always falls back to zero, isBottomSidebar stays true, and the sidebar keeps rendering even when the user collapses it on wide layouts.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit b263cbe. Configure here.
| // kept separate from the viewport `breakpoints` scale (see tokens/size.tsx). | ||
| // Bare responsive keys (e.g. `{md: …}`) resolve against these; `screen:`-prefixed | ||
| // keys resolve against viewport `breakpoints`. | ||
| export const containers = { |
There was a problem hiding this comment.
where are the screen: breakpoints defined actually? shouldn’t we define them with screen: in constants instead of prefixing them with screen: at runtime? Note that we only did this before because the token names were the same, which they are not anymore.
Replace the hand-maintained "at or above 4xl" breakpoint Set with
useResponsivePropValue({zero: 'bottom', '4xl': 'side'}), mirroring
groupDetailsLayout's own {zero, '4xl'} container-query prop exactly. This
declares the flip point once in the same form as the layout instead of
enumerating membership, so adding a higher container breakpoint can't silently
desync placement again. Export useResponsivePropValue from the layout barrel.
Sidebar placement now resolves against the query container's width via useResponsivePropValue instead of the viewport. The test rendered GroupDetailsLayout with no container ancestor, so jsdom's 0px container resolved to the bottom layout, which keeps the sidebar visible and broke the collapse assertion. Wrap the render in a Container(inline-size) and fake a desktop width so it exercises the collapsible side layout, as production does under organizationLayout.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit ce11468. Configure here.
| display={{'2xs': 'flex', lg: 'grid'}} | ||
| flexGrow={{'2xs': 1, lg: 0}} | ||
| display={{zero: 'flex', '4xl': 'grid'}} | ||
| flexGrow={{zero: 1, '4xl': 0}} |
There was a problem hiding this comment.
Missing query container ancestor
High Severity
Issue details now drives layout and sidebar behavior with bare container breakpoint keys and useResponsivePropValue, but GroupLayoutBody never sets containerType, so no query container or ContainerQueryProvider exists in production. JS and CSS stay on the zero base: the sidebar always behaves as bottom placement, collapsed side layout never applies, and the close toggle stays hidden on wide viewports.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit ce11468. Configure here.
…time
The container and viewport axes no longer share a scale, so synthesizing
the viewport prop keys as `screen:${breakpoint}` at runtime in both rc()
and useResponsivePropValue() no longer has the 'names are the same anyway'
justification it did when both axes iterated one BREAKPOINT_ORDER.
Declare the `screen:`-prefixed prop keys directly in VIEWPORT_ORDER (paired
with the bare theme.breakpoints token for the px lookup) so the keys are a
single defined source of truth read straight from the prop, rather than
assembled in two places. No behavior change.
natemoo-re
left a comment
There was a problem hiding this comment.
Just blocking because our tokens are primarily managed in Figma so I want to make sure we're in sync before we merge!


We need more granular breakpoints to make sure components fit perfectly inside their containers, so we are introducing a new scale specifically for container queries.
We decided to stick with T-shirt sizes (xs, sm, md, etc.). They might not be very semantic, but they are scalable, familiar, and widely used across the industry.
This PR introduces the new container-specific scales, updates the relevant files to use them, updates the Scraps markdown story.