Skip to content

Commit d90dde9

Browse files
committed
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 4908fa4 commit d90dde9

1 file changed

Lines changed: 14 additions & 11 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 & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -834,9 +834,10 @@ try {
834834
{/*
835835
The body is the scroll region so tall schema/code content stays inside
836836
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.
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.
840841
*/}
841842
<ChipModalBody className='gap-2 px-4'>
842843
<ChipModalTabs
@@ -1046,10 +1047,11 @@ try {
10461047
setShowEnvVars(false)
10471048
setSearchTerm('')
10481049
}}
1049-
inputRef={{
1050-
current: codeEditorRef.current?.querySelector(
1051-
'textarea'
1052-
) as HTMLTextAreaElement,
1050+
className='w-64'
1051+
style={{
1052+
position: 'absolute',
1053+
top: `${dropdownPosition.top}px`,
1054+
left: `${dropdownPosition.left}px`,
10531055
}}
10541056
/>
10551057
)}
@@ -1066,10 +1068,11 @@ try {
10661068
setShowTags(false)
10671069
setActiveSourceBlockId(null)
10681070
}}
1069-
inputRef={{
1070-
current: codeEditorRef.current?.querySelector(
1071-
'textarea'
1072-
) as HTMLTextAreaElement,
1071+
className='w-64'
1072+
style={{
1073+
position: 'absolute',
1074+
top: `${dropdownPosition.top}px`,
1075+
left: `${dropdownPosition.left}px`,
10731076
}}
10741077
/>
10751078
)}

0 commit comments

Comments
 (0)