Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

fix(webv2): stop vertical scroll areas inheriting zag's fit-content min-width

joshistoast543d87b9c66d
diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryDetailPanel.tsx b/invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryDetailPanel.tsx
index fd80966112..3c2913a1ed 100644
--- a/invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryDetailPanel.tsx
+++ b/invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryDetailPanel.tsx
@@ -60,17 +60,6 @@ import {
const DETAIL_RAIL_WIDTH = '18rem';
const THUMBNAIL_ASPECT_RATIO = 3 / 2;
const INSTALL_HOVER = { opacity: 0.85 } as const;
-/**
- * zag sets `min-width: fit-content` inline on every scroll-area content box, so
- * the box grows to its *min-content* width — and a long workflow name
- * contributes its full unbroken width there, however hard the heading itself
- * truncates. The rail then scrolled sideways (with no horizontal scrollbar,
- * since this area is vertical) and clipped every row in it. An inline override
- * is what it takes to beat an inline style; zeroing it makes the content box
- * stretch to the viewport and nothing more, so the heading's truncation is what
- * actually gives.
- */
-const RAIL_CONTENT_PROPS = { style: { minWidth: 0 } } as const;
export interface WorkflowLibraryDetailPanelProps {
entry: WorkflowLibraryEntry | null;
@@ -331,7 +320,7 @@ export const WorkflowLibraryDetailPanel = ({
rounded="md"
w={DETAIL_RAIL_WIDTH}
>
- <Scrollable contentProps={RAIL_CONTENT_PROPS} flex="1" label={name} minH="0" minW="0">
+ <Scrollable flex="1" label={name} minH="0">
<Stack gap="2" minW="0" p="2.5">
<Stack gap="1" minW="0">
<Box aspectRatio={THUMBNAIL_ASPECT_RATIO} bg="bg.muted" overflow="hidden" rounded="md" w="full">
diff --git a/invokeai/frontend/webv2/src/platform/ui/Scrollable.tsx b/invokeai/frontend/webv2/src/platform/ui/Scrollable.tsx
index de1206ab35..929d60ee2d 100644
--- a/invokeai/frontend/webv2/src/platform/ui/Scrollable.tsx
+++ b/invokeai/frontend/webv2/src/platform/ui/Scrollable.tsx
@@ -7,6 +7,18 @@ import { useRef } from 'react';
type ScrollAreaRootProps = ComponentProps<typeof ScrollArea.Root>;
type ScrollAreaContentProps = ComponentProps<typeof ScrollArea.Content>;
+/**
+ * zag pins `min-width: fit-content` *inline* on every scroll-area content box,
+ * so the box grows to its content's min-content width. A horizontal strip wants
+ * exactly that. In a vertical area it is a trap: one unbreakable string (a long
+ * name, an unwrapped identifier) widens the content box past the viewport, the
+ * area scrolls sideways — and since a vertical area renders no horizontal
+ * scrollbar, the overflow is simply unreachable. Vertical areas override it back
+ * to zero, so their content stretches to the viewport and truncation inside is
+ * what gives. Only an inline style can beat an inline style.
+ */
+const VERTICAL_CONTENT_STYLE = { minWidth: 0 } as const;
+
/**
* The workbench's standard scroll container: ScrollArea with hover-revealed
* scrollbars and the content wrapper zag needs for correct thumb sizing.
@@ -48,7 +60,11 @@ export const Scrollable = ({
role={label ? 'region' : undefined}
w="full"
>
- <ScrollArea.Content w={orientation === 'horizontal' ? 'max-content' : 'full'} {...contentProps}>
+ <ScrollArea.Content
+ style={orientation === 'horizontal' ? undefined : VERTICAL_CONTENT_STYLE}
+ w={orientation === 'horizontal' ? 'max-content' : 'full'}
+ {...contentProps}
+ >
{children}
</ScrollArea.Content>
</ScrollArea.Viewport>