Skip to content

Commit 0575875

Browse files
authored
fix(custom-tool): restore modal body scroll so Save stays reachable (#5321)
* 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. * fix(custom-tool): keep dropdown anchors content-relative on body scroll Review follow-up. The autocomplete popovers already portal their menus (never clipped by the body's scroll boundary), so the fix is only to restore the body as the scroll region. Reverting the dropdowns to their content-relative absolute anchors keeps them glued to the caret while the body scrolls; the caret-viewport inputRef anchoring used fixed viewport coordinates that only refreshed on edits, detaching the menu on scroll.
1 parent 33f9d64 commit 0575875

1 file changed

Lines changed: 7 additions & 5 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: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -832,12 +832,14 @@ 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 render their menus in portaled
838+
popovers (never clipped by this scroll boundary) and anchor to a
839+
caret-positioned element inside the editor wrapper, so the menus track
840+
the caret as the body scrolls.
839841
*/}
840-
<ChipModalBody className='flex-none gap-2 overflow-visible px-4'>
842+
<ChipModalBody className='gap-2 px-4'>
841843
<ChipModalTabs
842844
tabs={[
843845
{ value: 'schema', label: 'Schema' },

0 commit comments

Comments
 (0)