diff --git a/packages/kumo-docs-astro/src/components/demos/LayerDialogDemo.tsx b/packages/kumo-docs-astro/src/components/demos/LayerDialogDemo.tsx index 9528c617e..367c6f5fe 100644 --- a/packages/kumo-docs-astro/src/components/demos/LayerDialogDemo.tsx +++ b/packages/kumo-docs-astro/src/components/demos/LayerDialogDemo.tsx @@ -142,7 +142,10 @@ export function LayerDialogAlertDemo() { Delete Worker - Deleting {workerName}{" "} + Deleting{" "} + + {workerName} + {" "} is permanent. @@ -155,7 +158,11 @@ export function LayerDialogAlertDemo() { - Type {workerName} to confirm + Type{" "} + + {workerName} + {" "} + to confirm } onChange={(event) => setConfirmation(event.target.value)} diff --git a/packages/kumo-docs-astro/src/pages/components/layer-dialog.mdx b/packages/kumo-docs-astro/src/pages/components/layer-dialog.mdx index 618c030f9..92e5429ed 100644 --- a/packages/kumo-docs-astro/src/pages/components/layer-dialog.mdx +++ b/packages/kumo-docs-astro/src/pages/components/layer-dialog.mdx @@ -97,7 +97,7 @@ Consumers cannot mix these layouts or add more primary actions. Use the X for re ## Informational dialog -`Title` and `Description` always live in the bordered body surface. The title frame remains visible while the body scrolls, gains a bottom border after scrolling, and has the sole automatic X dismissal action. Once the body scrolls past the top, the description folds away beneath the title to give the content more room, and unfolds again at the top. The content edge mask signals overflow. +`Title` and `Description` always live in the bordered body surface. The title frame remains visible while the body scrolls and has the sole automatic X dismissal action. Once the body scrolls past the top, the description folds away beneath the title to give the content more room, and unfolds again at the top. The content edge mask signals overflow. diff --git a/packages/kumo/src/components/layer-dialog/layer-dialog.tsx b/packages/kumo/src/components/layer-dialog/layer-dialog.tsx index 7d612144f..3d925443f 100644 --- a/packages/kumo/src/components/layer-dialog/layer-dialog.tsx +++ b/packages/kumo/src/components/layer-dialog/layer-dialog.tsx @@ -326,7 +326,12 @@ export interface LayerDialogTitleProps { function LayerDialogTitle({ children }: LayerDialogTitleProps) { const title = (props: ComponentPropsWithoutRef<"h2">) => ( - + {children} ); @@ -360,13 +365,12 @@ export interface LayerDialogBodyProps { children: ReactNode; } -/** Scroll distance before the header shows its divider and condenses. */ +/** Scroll distance before the header description condenses. */ const SCROLL_THRESHOLD = 8; /** Overflow that must remain after the description collapses (see handleScroll). */ const CONDENSE_MIN_OVERFLOW = 16; function LayerDialogBody({ children }: LayerDialogBodyProps) { - const [hasScrolled, setHasScrolled] = useState(false); const [condensed, setCondensed] = useState(false); const descriptionClipRef = useRef(null); const dismissDisabled = useContext(DismissDisabledContext); @@ -376,7 +380,6 @@ function LayerDialogBody({ children }: LayerDialogBodyProps) { const handleScroll = (event: UIEvent) => { const { scrollTop, scrollHeight, clientHeight } = event.currentTarget; const scrolled = scrollTop > SCROLL_THRESHOLD; - setHasScrolled(scrolled); if (!scrolled) { setCondensed(false); @@ -404,15 +407,8 @@ function LayerDialogBody({ children }: LayerDialogBodyProps) { ); return ( - -
+ +
{title} {description && ( @@ -443,7 +439,7 @@ function LayerDialogBody({ children }: LayerDialogBodyProps) { className="min-h-0 flex-1 overscroll-none [mask-image:linear-gradient(to_bottom,transparent_0,black_min(24px,var(--scroll-area-overflow-y-start,24px)),black_calc(100%-min(24px,var(--scroll-area-overflow-y-end,24px))),transparent_100%)]" onScroll={handleScroll} > - + {content} @@ -472,8 +468,9 @@ function LayerDialogIconClose({ );