An open source design system that's fully customizable and agent ready
TypeScript
fix(Chat): stop clipping the hover radius on grouped ChatToolCalls rows (#4858)
Ojas Mutrejad79058293937
diff --git a/.changeset/chat-tool-calls-hover-radius-clip.md b/.changeset/chat-tool-calls-hover-radius-clip.mdnew file mode 100644index 0000000000..8ba0be120a--- /dev/null+++ b/.changeset/chat-tool-calls-hover-radius-clip.md@@ -0,0 +1,7 @@+---+'@astryxdesign/core': patch+---++[fix] ChatToolCalls: hover backgrounds on grouped call rows (2+ calls) now keep their full `--radius-element` rounding instead of getting clipped flat on the inline edges. `groupContentInner` — the `overflow: hidden` clip boundary the expand/collapse height animation needs — was missing the padding/negative-margin pair that absorbs the row-level hover-background overhang, so the overhang extended past the clip boundary and got cut off. Matches the ungrouped single-call row, which has no such wrapper to clip it.++@HelloOjasMutrejadiff --git a/packages/core/src/Chat/ChatToolCalls.test.tsx b/packages/core/src/Chat/ChatToolCalls.test.tsxindex f864bca9dd..15a0b6a34f 100644--- a/packages/core/src/Chat/ChatToolCalls.test.tsx+++ b/packages/core/src/Chat/ChatToolCalls.test.tsx@@ -216,4 +216,39 @@ describe('ChatToolCalls', () => {expect(region).toHaveTextContent('searchCode');expect(region).toHaveTextContent('readFile');});++ it('compensates the grouped rows overhang on the clip boundary so the hover background is not cut off', () => {+ render(+ <ChatToolCalls+ defaultIsExpanded={true}+ calls={[+ {name: 'bash', status: 'complete'},+ {name: 'read', status: 'complete'},+ ]}+ />,+ );+ const regionId = screen.getByRole('button').getAttribute('aria-controls');+ const groupContent = document.getElementById(regionId as string);+ // groupContentInner is the overflow:hidden clip boundary required for the+ // grid height animation; its direct child (`list`) pulls itself outward+ // by a negative inline margin so each row's hover background can overhang+ // the text column without widening the layout. Without a matching+ // padding/negative-margin pair on groupContentInner itself, that overhang+ // extends past the clip boundary and gets cut off (#4830) instead of+ // being absorbed the same way it is for a single, unwrapped call row.+ const groupContentInner = groupContent!.firstElementChild as HTMLElement;+ const list = groupContentInner.firstElementChild as HTMLElement;+ // jsdom's getComputedStyle doesn't resolve StyleX's generated atomic+ // classes here, so assert on the classes directly instead. StyleX emits+ // one atomic class per distinct property+value pair, so identical+ // paddingInline/marginInline values on two elements always produce the+ // exact same class names — if groupContentInner mirrors list's+ // padding/margin pair, their class lists intersect on (at least) those+ // two classes; if the fix is missing, groupContentInner only has its own+ // unrelated overflow/minHeight classes and shares nothing with list.+ const innerClasses = new Set(groupContentInner.className.split(' '));+ const listClasses = new Set(list.className.split(' '));+ const shared = [...listClasses].filter(c => innerClasses.has(c));+ expect(shared.length).toBeGreaterThanOrEqual(2);+ });});diff --git a/packages/core/src/Chat/ChatToolCalls.tsx b/packages/core/src/Chat/ChatToolCalls.tsxindex cb1b5e27ff..a2da3d9063 100644--- a/packages/core/src/Chat/ChatToolCalls.tsx+++ b/packages/core/src/Chat/ChatToolCalls.tsx@@ -160,6 +160,18 @@ const styles = stylex.create({groupContentInner: {overflow: 'hidden',minHeight: 0,+ // `list` (and, within it, each `callRowClickable` row) overhangs its own+ // content box by `--spacing-1` on each inline edge via a negative margin,+ // so its hover background can extend past the text column without+ // widening the layout — `list`'s own matching paddingInline absorbs the+ // row-level overhang, but `list`'s negative margin then overhangs *this*+ // element's box by the same amount, and this is the clip boundary the+ // grid height animation needs `overflow: hidden` for. Mirror the same+ // padding/negative-margin pair here so that overhang is absorbed too,+ // instead of clipped — matching the ungrouped single-call row, which has+ // no such wrapper to clip it.+ paddingInline: spacingVars['--spacing-1'],+ marginInline: `calc(-1 * ${spacingVars['--spacing-1']})`,},list: {display: 'flex',