Repository navigation
fix(chat): keep message padding in sub-viewport panes via container query (ENT-1020) - #5778
Merged
MikeRyanDev merged 2 commits intoJun 30, 2026
Conversation
BenTaylorDev
requested review from
jpr5,
marthakelly,
mme,
ranst91 and
tylerslaton
as code owners
June 30, 2026 14:47
Contributor
📣 Social Copy GeneratorGenerate social media copies (Twitter/X, LinkedIn, Blog Post) for this PR using Claude.
|
BenTaylorDev
force-pushed
the
ben1/ent-1020-copilotchat-message-padding-collapses-to-0-in-narrow-side-by
branch
from
June 30, 2026 15:27
46429ac to
c03f6ff
Compare
@copilotkit/a2ui-renderer
@copilotkit/agentcore-runner
@copilotkit/angular
@copilotkit/bot
@copilotkit/bot-discord
@copilotkit/bot-slack
@copilotkit/bot-teams
@copilotkit/bot-telegram
@copilotkit/bot-ui
@copilotkit/bot-whatsapp
@copilotkit/core
@copilotkit/react-core
@copilotkit/react-native
@copilotkit/react-textarea
@copilotkit/react-ui
@copilotkit/runtime
@copilotkit/runtime-client-gql
@copilotkit/sdk-js
@copilotkit/shared
@copilotkit/sqlite-runner
@copilotkit/voice
@copilotkit/vue
@copilotkit/web-components
@copilotkit/web-inspector
commit: |
Contributor
|
Size Change: +31 B (0%) Total Size: 1.1 MB 📦 View Changed
ℹ️ View Unchanged
|
…uery CopilotChat message wrappers used viewport-keyed `cpk:sm:px-0`, collapsing horizontal padding to 0 at any viewport >=640px. The message column is `max-w-3xl` (768px) centered; the design assumes the chat fills the viewport, so at >=640px the column has side gutters and inner padding can drop to 0. But when the chat lives in a sub-viewport-width pane (e.g. the threads drawer rail beside the chat, ~580px on an 820px iPad-portrait viewport), `sm:px-0` still fires on viewport width while the 768px column overflows the narrow pane and sits flush against both edges. The input wrapper looked fine because it is visually inset by its own pill, so only message text appeared broken. Make the padding container-relative instead of viewport-relative: - add `cpk:@container` (container-type: inline-size) to the chat root, and - switch the message/input/suggestion wrappers from `cpk:sm:px-0` to the container variant `cpk:@3xl:px-0`. Padding now tracks the chat's own width and drops to 0 only once the container is at least as wide as the column's own max-width, so the column has real gutters; in any narrower pane the `px-4` inner padding is retained. React, Angular, and Vue kept in lockstep. Note on the breakpoint: Tailwind v4 container-query breakpoints differ from viewport breakpoints (`@sm` = 24rem/384px, not 640px). A mechanical `sm:` -> `@sm:` swap would still collapse the ~580px repro pane. `@3xl` (48rem/768px) is used because it exactly matches the column's `max-w-3xl`, which is the width at which side gutters first appear. Verified: full-width desktop chat unchanged (container >=768px -> px-0); 580px pane retains 16px padding; render-prop layouts without a container ancestor degrade safely to `px-4`; sidebar/popup `data-*` padding overrides are unaffected. ENT-1020 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
BenTaylorDev
force-pushed
the
ben1/ent-1020-copilotchat-message-padding-collapses-to-0-in-narrow-side-by
branch
from
June 30, 2026 19:26
cb7d2e6 to
097d734
Compare
MikeRyanDev
approved these changes
Jun 30, 2026
MikeRyanDev
deleted the
ben1/ent-1020-copilotchat-message-padding-collapses-to-0-in-narrow-side-by
branch
June 30, 2026 21:37
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Fixes ENT-1020. In a side-by-side layout (the threads drawer rail next to the chat), at iPad-portrait / tablet widths the chat message text sat flush against both pane edges — no horizontal padding — while the input stayed correctly inset. Surfaced while manually testing the Angular
CopilotDrawer(#5746), but it is not a drawer bug: it reproduces in any layout that putsCopilotChatin a pane narrower than the viewport.Root cause
The message column is
max-w-3xl(768px) centered; its wrappers usedcpk:px-4 cpk:sm:px-0— 16px below 640px, then 0 at viewport ≥640px. There was nocontainer-typeon the chat root, so thesm:variant keyed on the viewport, not the chat's own width. In a sub-viewport pane (~580px chat on an 820px viewport)sm:px-0still fired (viewport ≥640) while the 768px column overflowed the pane edge-to-edge → flush text.The fix (robust / container-relative)
cpk:@container(container-type: inline-size) to the chat root (React ×2 render paths, Angular, Vue).cpk:sm:px-0to the container variantcpk:@3xl:px-0.Padding now tracks the chat's own width and drops to 0 only once the container is at least as wide as the column's
max-w-3xl, i.e. once the column has real side gutters. In any narrower pane thepx-4inner padding is retained. React, Angular, and Vue kept in lockstep.Why
@3xl, not the@smthe ticket suggestedTailwind v4 container-query breakpoints are a different scale from viewport breakpoints:
@sm= 24rem/384px (viewportsm= 640px). A mechanicalsm:→@sm:swap would still collapse the ~580px repro pane (580 ≥ 384).@3xl= 48rem/768px, which exactly matches the column'smax-w-3xl— the width at which gutters first appear — so it is the semantically correct breakpoint.Testing
Browser behavior — real built CSS, exact DOM (
copilotKitChat/@containerroot →cpk:max-w-3xl cpk:mx-auto→cpk:px-4 cpk:@3xl:px-0message wrapper),getComputedStyle().paddingLeft:padding-left: 16pxpx-4retained — text no longer flushpadding-left: 0pxpx-0— column has gutters, behavior preserved@containerancestor (render-prop path)padding-left: 16pxpx-4, no flushGenerated CSS confirmed (Tailwind v4.1.18): root emits
container-type: inline-size; wrapper emits@container (min-width: 48rem) { padding-inline: 0 }(verified in both react-core and angular builds — a true container query, not a media query).Unit/component tests (pass):
CopilotChatCssClasses).copilot-chat-view+copilot-chat-inputspecs: 10 green.CopilotChatView.connectingGate+CopilotChatSuggestionView.slots.e2e: 30 green.test-and-check-packages(test + publint + attw across all 4 affected projects) passed.No tests assert these class strings and no snapshots capture them, so nothing needed regenerating.
Acceptance criteria
px-0), verified in React, Angular, Vue.@3xlswitch).Closes ENT-1020
🤖 Generated with Claude Code