Skip to content

fix(a2ui-renderer,vue): keep full-width components inside their container - #8567

Open
justin-john wants to merge 1 commit into
CopilotKit:mainfrom
justin-john:fix/a2ui-leaf-full-width-overflow
Open

justin-john wants to merge 1 commit into
CopilotKit:mainfrom
justin-john:fix/a2ui-leaf-full-width-overflow

Conversation

@justin-john

@justin-john justin-john commented Nov 25, 2026 •

Copy link
Copy Markdown

What does this PR do?

Fixes basic catalog components that run 8px past their container.

A component that fills its container was styled width: 100% and also given an 8px margin on each side, so it was 16px wider than the container. In a Column or a vertical List its right edge ran 8px past the container and was clipped by the surface. Inside a Card it ran into the Card's right padding.

This adds LEAF_FULL_WIDTH (calc(100% - 2 * LEAF_MARGIN)) and uses it for the ten components that had both the margin and width: 100%: Image, Video, AudioPlayer, Card, Tabs, Divider, TextField, ChoicePicker, Slider and DateTimeInput. The React and Vue basic catalogs get the same change.

The issue reports the TextField only. The other nine have the same cause, so they are fixed together.

How it was checked

  • Rendered all 17 basic catalog components in a Column, in both renderers, and measured them in Chrome at 320px. The ten above were 8px past the edge before and fit after. The other seven were not affected.
  • Compared position and width before and after for those ten in 14 layouts (Row, Card, List, Tabs, Modal trigger, Button, surface root). No layout overflows that did not overflow before. A component alone in a Row, or two in a Row, is identical to the pixel.
  • One new test per package (TextField, Slider, Card and Divider in a Column). Both fail without the fix.

Visible changes

  • A component inside a Card no longer runs into the Card's right padding, so the spacing is even on both sides.
  • In a Row with a Text beside a full-width component, the split shifts by 2px.

Not changed here: two Videos or two DateTimeInputs side by side in a narrow Row still overflow, because of the elements' own minimum widths.

Related PRs and Issues

Checklist

  • I have read the Contribution Guide
  • If the PR changes or adds functionality, I have updated the relevant documentation (not applicable: no API or docs change)
  • If the PR contains a breaking change, the title has ! (for example feat(react-core)!: ...) and the description has a BREAKING CHANGE: line with migration steps. See VERSIONING.md (not applicable: not a breaking change)
  • "Allow edits by maintainers" is checked (lets us help iterate on your PR directly — faster turnaround for everyone)

Summary by CodeRabbit

  • Bug Fixes
    • Updated basic catalog components in React and Vue to account for their 8px side margins when setting full-width elements, preventing them from exceeding their available space.
  • Tests
    • Added coverage to verify that full-width text fields, sliders, cards, and dividers fit within their margins.

…iner

A basic catalog component that fills its container was styled `width: 100%`
and also given an 8px margin on each side, so it was wider than the
container by twice the margin. In a Column or a List its right edge ran 8px
past the container and was clipped: a TextField lost its right border.

The width now leaves room for the margin (`LEAF_FULL_WIDTH`), in the React
and Vue basic catalogs alike: Image, Video, AudioPlayer, Card, Tabs,
Divider, TextField, ChoicePicker, Slider and DateTimeInput.

Fixes CopilotKit#8565
@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

React and Vue basic catalog components now use a shared width expression that subtracts twice the leaf margin from full width. New rendering tests check the adjusted widths for selected components in both renderers.

Changes: Basic catalog widths

Layer / File(s) Summary
React width adjustment and tests
packages/a2ui-renderer/src/react-renderer/a2ui-react/catalog/basic/utils.ts, packages/a2ui-renderer/src/react-renderer/a2ui-react/catalog/basic/components/*, packages/a2ui-renderer/src/react-renderer/__tests__/basic-catalog-full-width.test.tsx
The React catalog defines LEAF_FULL_WIDTH as calc(100% - 2 * LEAF_MARGIN) and uses it in audio, card, choice picker, date-time input, divider, image, slider, tabs, text field, and video components. The test checks adjusted widths for four elements with an 8px margin and verifies that none use width: 100%.
Vue width adjustment and tests
packages/vue/src/v2/components/a2ui/utils.ts, packages/vue/src/v2/components/a2ui/catalog.ts, packages/vue/src/v2/components/__tests__/A2UIBasicCatalogFullWidth.test.ts
The Vue catalog defines and uses LEAF_FULL_WIDTH for the same component types. The test checks adjusted widths for four elements with an 8px margin and verifies that none use width: 100%.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Possibly related issues

  • CopilotKit/CopilotKit#8565 — The Vue catalog width adjustment targets the reported overflow caused by combining width: 100% with an 8px margin.

Suggested reviewers: contextablemark

Merge Risk: Minimal · up to cd7a0

Basic catalog components no longer overflow their container by 16px when width: 100% is combined with 8px side margins. The change is small, confined to inline style values, and easily reversible. Tests check the adjusted width declarations in both the React and Vue renderers. No concrete merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: full-width basic catalog components are kept inside their container. The raw summary shows LEAF_FULL_WIDTH replacing width 100% with calc(100% - 2 * LEAF_MARGIN) acros…
Linked Issues check Passed Issue #8565 requires that a Vue basic-catalog TextField placed directly in a Column fit its container with margin on both sides. The reviewed diff adds LEAF_FULL_WIDTH (`calc(100% - 2 * LEAF_MARGIN)…
Out of Scope Changes check Passed The additional changes apply the same fix to nine other components (Image, Video, AudioPlayer, Card, Tabs, Divider, ChoicePicker, Slider, DateTimeInput) in the Vue catalog and in the React basic catal…
Full details: Title check

Explanation

The title names the main change: full-width basic catalog components are kept inside their container. The raw summary shows LEAF_FULL_WIDTH replacing width 100% with calc(100% - 2 * LEAF_MARGIN) across React and Vue components, which matches the title's scope. The 'fix(a2ui-renderer,vue)' prefix follows conventional commit style and names both affected packages. The title is 73 characters, slightly long but within a readable range.

Full details: Linked Issues check

Explanation

Issue #8565 requires that a Vue basic-catalog TextField placed directly in a Column fit its container with margin on both sides. The reviewed diff adds LEAF_FULL_WIDTH (calc(100% - 2 * LEAF_MARGIN)) in packages/vue/src/v2/components/a2ui/utils.ts and uses it for the TextField width in packages/vue/src/v2/components/a2ui/catalog.ts. The wrapper's outer width becomes 100% of the parent, so the 8px margins fit inside it. This matches the issue's second suggested fix. The issue's Lit --a2ui-textfield-width note is context and not a requirement. A new Vue test (A2UIBasicCatalogFullWidth.test.ts) asserts the calc width for the TextField, Slider, Card and Divider and that no element uses width: 100%. The PR description reports that the test fails without the fix. Evidence is from the PR summary and description; I did not run the test or inspect the code hunks directly, so the result rests on the summary's account of the diff.

Full details: Out of Scope Changes check

Explanation

The additional changes apply the same fix to nine other components (Image, Video, AudioPlayer, Card, Tabs, Divider, ChoicePicker, Slider, DateTimeInput) in the Vue catalog and in the React basic catalog. The issue states that four other components in the same catalog combine width: "100%" with the shared leaf margin, which is the same root cause. The new LEAF_FULL_WIDTH constant and the React changes are a direct connection to the same defect, so they are not unrelated. The React renderer changes go beyond the Vue-only issue text, but the PR description states the same defect exists in React. The 2px split shift in Rows with Text is a documented side effect of the same fix. The React test file and the Vue test file support the changes. Evidence is from the summary and description; the diffs were not inspected directly.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

packages/vue/src/v2/components/__tests__/A2UIBasicCatalogFullWidth.test.ts

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.

packages/vue/src/v2/components/a2ui/catalog.ts

ESLint skipped: the matched ESLint configuration already failed (missing-dependency).

packages/vue/src/v2/components/a2ui/utils.ts

ESLint skipped: the matched ESLint configuration already failed (missing-dependency).

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 7f7ba6f and cd7a0c1.

Files selected for processing: 15

  • packages/a2ui-renderer/src/react-renderer/__tests__/basic-catalog-full-width.test.tsx
  • packages/a2ui-renderer/src/react-renderer/a2ui-react/catalog/basic/components/AudioPlayer.tsx
  • packages/a2ui-renderer/src/react-renderer/a2ui-react/catalog/basic/components/Card.tsx
  • packages/a2ui-renderer/src/react-renderer/a2ui-react/catalog/basic/components/ChoicePicker.tsx
  • packages/a2ui-renderer/src/react-renderer/a2ui-react/catalog/basic/components/DateTimeInput.tsx
  • packages/a2ui-renderer/src/react-renderer/a2ui-react/catalog/basic/components/Divider.tsx
  • packages/a2ui-renderer/src/react-renderer/a2ui-react/catalog/basic/components/Image.tsx
  • packages/a2ui-renderer/src/react-renderer/a2ui-react/catalog/basic/components/Slider.tsx
  • packages/a2ui-renderer/src/react-renderer/a2ui-react/catalog/basic/components/Tabs.tsx
  • packages/a2ui-renderer/src/react-renderer/a2ui-react/catalog/basic/components/TextField.tsx
  • packages/a2ui-renderer/src/react-renderer/a2ui-react/catalog/basic/components/Video.tsx
  • packages/a2ui-renderer/src/react-renderer/a2ui-react/catalog/basic/utils.ts
  • packages/vue/src/v2/components/__tests__/A2UIBasicCatalogFullWidth.test.ts
  • packages/vue/src/v2/components/a2ui/catalog.ts
  • packages/vue/src/v2/components/a2ui/utils.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A2UI Vue basic catalog: TextField overflows its container by 16px (width: 100% plus margin: 8px)

1 participant