Skip to content

Commit c46ef1b

Browse files
committed
fix(rich-editor): make suggestion menus scrollable inside modals
- Mount the slash/@ menu popup inside the host dialog (when present) instead of document.body: Radix's scroll-lock blocks wheel events outside the dialog subtree, so a body-level popup couldn't scroll in a modal. position:fixed keeps it viewport-positioned (the modal centers via flex, no transform) so it isn't clipped - Fix the invalid max-w arbitrary value (calc needs spaces) that left the menu uncapped - Match the version-description editor's dynamic-import loading height to the field so the modal doesn't grow when the chunk loads
1 parent 0565c4d commit c46ef1b

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor/menus/suggestion-menu-chrome.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
/** The floating panel: bordered card with the enter animation, width-capped like the chat mention menu. */
88
export const SUGGESTION_SURFACE_CLASS =
9-
'min-w-[220px] max-w-[min(300px,calc(100vw-32px))] origin-top-left animate-in rounded-xl border border-[var(--border)] bg-[var(--bg)] p-1.5 shadow-sm duration-100 fade-in-0 zoom-in-95 slide-in-from-top-2 motion-reduce:animate-none'
9+
'min-w-[220px] max-w-[320px] origin-top-left animate-in rounded-xl border border-[var(--border)] bg-[var(--bg)] p-1.5 shadow-sm duration-100 fade-in-0 zoom-in-95 slide-in-from-top-2 motion-reduce:animate-none'
1010

1111
/**
1212
* A scrollable list body, added alongside {@link SUGGESTION_SURFACE_CLASS}. Caps the height and scrolls

apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor/menus/suggestion-popup.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@ export function createSuggestionPopupRenderer<P, H extends SuggestionListHandle>
7272
popup = document.createElement('div')
7373
popup.className = 'fixed top-0 left-0 z-[var(--z-popover)]'
7474
popup.appendChild(component.element)
75-
document.body.appendChild(popup)
75+
// Mount inside the host dialog when the editor is in a modal: Radix's scroll-lock blocks wheel
76+
// events outside the dialog subtree, so a body-level popup can't be scrolled. `position: fixed`
77+
// keeps it viewport-positioned (the modal centers via flex, no transform) so it isn't clipped.
78+
const host = props.editor.view.dom.closest('[role="dialog"]') ?? document.body
79+
host.appendChild(popup)
7680
boundEditor = props.editor
7781
boundEditor.on('destroy', teardown)
7882
const reference = { getBoundingClientRect: () => props.clientRect?.() ?? new DOMRect() }

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/components/general/components/version-description-modal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const RichMarkdownField = dynamic(
2626
).then((m) => m.RichMarkdownField),
2727
{
2828
ssr: false,
29-
loading: () => <div className={cn('min-h-[120px]', chipFieldSurfaceClass)} />,
29+
loading: () => <div className={cn('min-h-[240px]', chipFieldSurfaceClass)} />,
3030
}
3131
)
3232

0 commit comments

Comments
 (0)