Skip to content

Commit ad94fcd

Browse files
committed
fix(platform): give a dialog portalled out of a surface its own surface
A surface inside a surface collapses by context, and a portal keeps context, so BodyDialog under ResponseActions' Surface rendered at the body with no [data-platform-ui] and the feedback form lost all its styling.
1 parent a488518 commit ad94fcd

3 files changed

Lines changed: 9 additions & 4 deletions

File tree

‎apps/sim/platform/design-system/components/surface/platform-surface.tsx‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ interface PlatformSurfaceProps {
1111
systemMono?: boolean
1212
/** Paints the canvas, for a surface that fills a region. Otherwise whatever is behind shows through. */
1313
canvas?: boolean
14+
/** Starts a surface even inside another, for a tree a portal carries out of the outer one's DOM. */
15+
detached?: boolean
1416
children: ReactNode
1517
}
1618

@@ -24,9 +26,10 @@ export function PlatformSurface({
2426
systemFont,
2527
systemMono,
2628
canvas,
29+
detached,
2730
}: PlatformSurfaceProps) {
2831
const nested = useContext(InsideSurface)
29-
if (nested) return children
32+
if (nested && !detached) return children
3033
return (
3134
<div
3235
data-platform-ui=''

‎apps/sim/platform/design-system/components/surface/surface.tsx‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import styles from '@/platform/design-system/components/surface/surface.module.c
88
interface SurfaceProps {
99
/** Paints the canvas, for a surface that fills a region. */
1010
canvas?: boolean
11+
/** For a tree portalled out of its parent surface, whose context still says it is inside one. */
12+
detached?: boolean
1113
children: ReactNode
1214
}
1315

@@ -18,9 +20,9 @@ interface SurfaceProps {
1820
* Never render a legacy component inside: the surface redefines tokens legacy utilities read. Compose
1921
* one beside a surface instead.
2022
*/
21-
export function Surface({ canvas, children }: SurfaceProps) {
23+
export function Surface({ canvas, detached, children }: SurfaceProps) {
2224
return (
23-
<PlatformSurface theme='system' canvas={canvas}>
25+
<PlatformSurface theme='system' canvas={canvas} detached={detached}>
2426
{children}
2527
</PlatformSurface>
2628
)

‎apps/sim/platform/embedded/app/(shell)/_components/conversation/dialogs.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ interface BodyDialogProps {
2121
export function BodyDialog({ className, children }: BodyDialogProps) {
2222
return createPortal(
2323
<div className={className ? `${className} ${styles.dialogHost}` : styles.dialogHost}>
24-
<Surface>{children}</Surface>
24+
<Surface detached>{children}</Surface>
2525
</div>,
2626
document.body
2727
)

0 commit comments

Comments
 (0)