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(widgets): use ScrollArea for left/right panel scrolling

joshistoastb41788f9e1df
diff --git a/invokeai/frontend/webv2/src/workbench/components/ui/Scrollable.tsx b/invokeai/frontend/webv2/src/workbench/components/ui/Scrollable.tsx
index a1c0fe7bef..c991b4573e 100644
--- a/invokeai/frontend/webv2/src/workbench/components/ui/Scrollable.tsx
+++ b/invokeai/frontend/webv2/src/workbench/components/ui/Scrollable.tsx
@@ -3,6 +3,7 @@ import type { ComponentProps, ReactNode } from 'react';
import { ScrollArea } from '@chakra-ui/react';
type ScrollAreaRootProps = ComponentProps<typeof ScrollArea.Root>;
+type ScrollAreaContentProps = ComponentProps<typeof ScrollArea.Content>;
/**
* The workbench's standard scroll container: ScrollArea with hover-revealed
@@ -11,16 +12,21 @@ type ScrollAreaRootProps = ComponentProps<typeof ScrollArea.Root>;
*/
export const Scrollable = ({
children,
+ contentProps,
label,
...rootProps
}: ScrollAreaRootProps & {
children: ReactNode;
+ /** Extra props for the content wrapper, e.g. to let children fill the viewport height. */
+ contentProps?: ScrollAreaContentProps;
/** Accessible name for the scroll viewport. */
label?: string;
}) => (
<ScrollArea.Root size="xs" variant="hover" {...rootProps}>
<ScrollArea.Viewport aria-label={label} h="full" w="full">
- <ScrollArea.Content w="full">{children}</ScrollArea.Content>
+ <ScrollArea.Content w="full" {...contentProps}>
+ {children}
+ </ScrollArea.Content>
</ScrollArea.Viewport>
<ScrollArea.Scrollbar>
<ScrollArea.Thumb />
diff --git a/invokeai/frontend/webv2/src/workbench/widget-frame/WidgetRenderer.tsx b/invokeai/frontend/webv2/src/workbench/widget-frame/WidgetRenderer.tsx
index bc1c786ac0..9c09bf9157 100644
--- a/invokeai/frontend/webv2/src/workbench/widget-frame/WidgetRenderer.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widget-frame/WidgetRenderer.tsx
@@ -7,6 +7,7 @@ import type {
} from '@workbench/types';
import { Box, Flex, Text } from '@chakra-ui/react';
+import { Scrollable } from '@workbench/components/ui';
import { areWidgetPlacementProjectsEqual, getWidgetPlacementProject } from '@workbench/widgetPlacementMeta';
import { useActiveProjectSelector, useWorkbenchDispatch } from '@workbench/WorkbenchContext';
import { useWorkbenchWidgetRegistry } from '@workbench/WorkbenchWidgetRegistryContext';
@@ -236,10 +237,14 @@ const HeaderSlot = memo(function HeaderSlot({
);
}, areSlotPropsEqual);
+// Grid content with minH="full" stretches fill-height widget views (gallery,
+// layers, preview) to the viewport while letting flowing views grow and scroll.
+const panelBodyContentProps = { display: 'grid', minH: 'full' } as const;
+
const PanelBodySlot = ({ children }: { children: React.ReactNode }) => (
- <Flex direction="column" flex="1" minH="0" minW="0" overflowX="hidden" overflowY="auto">
+ <Scrollable contentProps={panelBodyContentProps} flex="1" minH="0" minW="0" overflowX="hidden">
{children}
- </Flex>
+ </Scrollable>
);
const FooterSlot = memo(function FooterSlot({