Skip to content

Commit 4908fa4

Browse files
committed
fix(custom-tool): restore modal body scroll so Save stays reachable
The Edit/Create Agent Tool modal clipped its footer (Save/Update) and could not scroll with long code or schema content. Root cause: #4354 migrated the modal to ChipModal and changed the body from a scroll region (flex-1 overflow-y-auto) to flex-none overflow-visible so the hand-positioned EnvVar/Tag autocompletes could spill past it. That removed the scroll region, so tall content grew the body past the modal's max-h-[84vh] cap and the overflow-hidden surface clipped the footer. Restore ChipModalBody as the scroll region (its documented behavior) and switch the EnvVar/Tag dropdowns to portaled inputRef caret-anchoring, matching the canonical Function-block editor, so they anchor to the caret in a portal and are never clipped by the scroll boundary.
1 parent 2393b72 commit 4908fa4

1 file changed

Lines changed: 14 additions & 15 deletions

File tree

  • apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/components/custom-tool-modal

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/components/custom-tool-modal/custom-tool-modal.tsx

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -832,12 +832,13 @@ try {
832832
</ChipModalHeader>
833833

834834
{/*
835-
flex-none + overflow-visible opt this body out of the chrome's
836-
scroll container: the caret-anchored EnvVar/Tag autocomplete
837-
dropdowns are absolute-positioned inside it and must spill past
838-
the body's bounds rather than clip against a scroll boundary.
835+
The body is the scroll region so tall schema/code content stays inside
836+
the modal and the footer (Next/Save) is always reachable. The EnvVar,
837+
Tag, and schema-param autocompletes anchor to the textarea caret and
838+
render in portaled popovers, so they aren't clipped by this scroll
839+
boundary — see the `inputRef` wiring below.
839840
*/}
840-
<ChipModalBody className='flex-none gap-2 overflow-visible px-4'>
841+
<ChipModalBody className='gap-2 px-4'>
841842
<ChipModalTabs
842843
tabs={[
843844
{ value: 'schema', label: 'Schema' },
@@ -1045,11 +1046,10 @@ try {
10451046
setShowEnvVars(false)
10461047
setSearchTerm('')
10471048
}}
1048-
className='w-64'
1049-
style={{
1050-
position: 'absolute',
1051-
top: `${dropdownPosition.top}px`,
1052-
left: `${dropdownPosition.left}px`,
1049+
inputRef={{
1050+
current: codeEditorRef.current?.querySelector(
1051+
'textarea'
1052+
) as HTMLTextAreaElement,
10531053
}}
10541054
/>
10551055
)}
@@ -1066,11 +1066,10 @@ try {
10661066
setShowTags(false)
10671067
setActiveSourceBlockId(null)
10681068
}}
1069-
className='w-64'
1070-
style={{
1071-
position: 'absolute',
1072-
top: `${dropdownPosition.top}px`,
1073-
left: `${dropdownPosition.left}px`,
1069+
inputRef={{
1070+
current: codeEditorRef.current?.querySelector(
1071+
'textarea'
1072+
) as HTMLTextAreaElement,
10741073
}}
10751074
/>
10761075
)}

0 commit comments

Comments
 (0)