Skip to content

ref(scraps): Add dedicated container query breakpoint tokens#119804

Open
priscilawebdev wants to merge 7 commits into
masterfrom
prisca/ref-scraps-container-query-tokens
Open

ref(scraps): Add dedicated container query breakpoint tokens#119804
priscilawebdev wants to merge 7 commits into
masterfrom
prisca/ref-scraps-container-query-tokens

Conversation

@priscilawebdev

@priscilawebdev priscilawebdev commented Jul 16, 2026

Copy link
Copy Markdown
Member

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.

@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jul 16, 2026
@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Story previews

Preview the stories changed in this PR on the Vercel deployment:

Preview deployment: https://sentry-8w0ventt3.sentry.dev

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.
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.
@priscilawebdev

Copy link
Copy Markdown
Member Author

bugbot run

Comment thread static/app/views/issueDetails/groupDetailsLayout.tsx
@priscilawebdev priscilawebdev marked this pull request as ready for review July 16, 2026 09:52
@priscilawebdev priscilawebdev requested review from a team as code owners July 16, 2026 09:52
@priscilawebdev priscilawebdev requested a review from TkDodo July 16, 2026 09:52
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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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)
Fix in Cursor Fix in Web

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 = {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

good idea! 52cab71

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.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ 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}}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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)
Fix in Cursor Fix in Web

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 natemoo-re left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just blocking because our tokens are primarily managed in Figma so I want to make sure we're in sync before we merge!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants