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): span the canvas staging strip across the full widget width

joshistoast1eb92ab3731a
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasBottomOverlay.test.tsx b/invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasBottomOverlay.test.tsx
index 0094cd6cde..7ea85b99ba 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasBottomOverlay.test.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasBottomOverlay.test.tsx
@@ -7,6 +7,7 @@ import {
BOTTOM_CONTROLS_SLOT_LAYOUT,
BOTTOM_OVERLAY_LAYOUT,
BOTTOM_OVERLAY_STACK_LAYOUT,
+ BOTTOM_STAGING_SLOT_LAYOUT,
CanvasBottomOverlay,
} from './CanvasBottomOverlay';
@@ -17,6 +18,10 @@ describe('CanvasBottomOverlay', () => {
expect(BOTTOM_CONTROLS_SLOT_LAYOUT).toMatchObject({ flex: '0 1 auto', minH: '0', overflow: 'hidden' });
});
+ it('spans the staging slot across the canvas so its thumbnail strip can scroll', () => {
+ expect(BOTTOM_STAGING_SLOT_LAYOUT).toMatchObject({ flexShrink: '0', minW: '0', w: 'full' });
+ });
+
it('server-renders staging above controls inside the bounded layout', () => {
const markup = renderToStaticMarkup(
<ChakraProvider value={system}>
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasBottomOverlay.tsx b/invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasBottomOverlay.tsx
index 646e8bee2c..230a7d6319 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasBottomOverlay.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasBottomOverlay.tsx
@@ -23,6 +23,17 @@ export const BOTTOM_OVERLAY_STACK_LAYOUT = {
overflow: 'hidden',
} satisfies StackProps;
+/**
+ * The staging slot spans the canvas rather than hugging its content, so the
+ * staged-thumbnail strip gets the whole widget width to scroll within while the
+ * bars it contains stay centered.
+ */
+export const BOTTOM_STAGING_SLOT_LAYOUT = {
+ flexShrink: '0',
+ minW: '0',
+ w: 'full',
+} satisfies BoxProps;
+
export const BOTTOM_CONTROLS_SLOT_LAYOUT = {
align: 'center',
flex: '0 1 auto',
@@ -42,7 +53,7 @@ const Root = forwardRef<HTMLDivElement, BoxProps>(({ children, ...props }, ref)
));
Root.displayName = 'CanvasBottomOverlay.Root';
-const Staging = (props: BoxProps) => <Box flexShrink="0" {...props} />;
+const Staging = (props: BoxProps) => <Box {...BOTTOM_STAGING_SLOT_LAYOUT} {...props} />;
const Controls = (props: FlexProps) => <Flex {...BOTTOM_CONTROLS_SLOT_LAYOUT} {...props} />;
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/canvas/StagingBar.browser.test.tsx b/invokeai/frontend/webv2/src/workbench/widgets/canvas/StagingBar.browser.test.tsx
index 4e469c3a54..149da9daf8 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/canvas/StagingBar.browser.test.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/canvas/StagingBar.browser.test.tsx
@@ -99,8 +99,9 @@ const renderStagingBar = async (slotCount: number, selectedImageIndex = 0) => {
});
const viewport = host.querySelector<HTMLElement>('[data-scope="scroll-area"][data-part="viewport"]')!;
+ const overlay = host.firstElementChild!.firstElementChild as HTMLElement;
- return { thumbnails: Array.from(viewport.querySelectorAll<HTMLElement>('button')), viewport };
+ return { overlay, thumbnails: Array.from(viewport.querySelectorAll<HTMLElement>('button')), viewport };
};
beforeAll(async () => {
@@ -124,12 +125,14 @@ afterEach(async () => {
describe('StagingBar thumbnail strip', () => {
it('keeps every thumbnail reachable by scrolling when many images are staged', async () => {
- const { thumbnails, viewport } = await renderStagingBar(24);
+ const { overlay, thumbnails, viewport } = await renderStagingBar(24);
const bounds = viewport.getBoundingClientRect();
expect(thumbnails).toHaveLength(24);
- // The strip scrolls inside the floating bar group instead of stretching it
- // past the canvas, where the overlay would silently clip it.
+ // The strip gets the full canvas widget to scroll within — not the width of
+ // the options bar beneath it, and never wider than the canvas itself (the
+ // overlay would silently clip the centered overflow at both edges).
+ expect(bounds.width).toBe(overlay.getBoundingClientRect().width);
expect(bounds.width).toBeLessThanOrEqual(CANVAS_WIDTH);
expect(viewport.scrollWidth).toBeGreaterThan(viewport.clientWidth);
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/canvas/StagingBar.tsx b/invokeai/frontend/webv2/src/workbench/widgets/canvas/StagingBar.tsx
index 6d38fc1ef0..9fbebc9876 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/canvas/StagingBar.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/canvas/StagingBar.tsx
@@ -43,7 +43,6 @@ import { CanvasFloatingBarDivider } from './CanvasFloatingBar';
type AutoSwitchMode = CanvasStagingAreaContractV2['autoSwitchMode'];
const THUMBNAIL_STRIP_HEIGHT = '5rem';
-const STRIP_CONTAIN_CSS = { contain: 'inline-size' } as const;
const AUTO_SWITCH_MODES: AutoSwitchMode[] = ['off', 'progress', 'latest'];
const MENU_POSITIONING = { placement: 'top-end' } as const;
@@ -128,15 +127,13 @@ export const StagingBar = ({
return (
<Stack align="center" gap="2" w="full">
{hasSlots ? (
- // `contain: inline-size` zeroes the strip's intrinsic width, so a long
- // run of staged candidates can never push the floating bar group wider
- // than the canvas (the bottom overlay would just clip the overflow, and
- // centering hides half of it). The strip instead tracks the width of the
- // options bar below it and scrolls within it.
+ // The strip spans the whole canvas widget and scrolls within it: the
+ // overlay's staging slot stretches, so this width is definite and a long
+ // run of staged candidates can only ever scroll — never widen the
+ // floating bar group past the canvas, where the overlay would silently
+ // clip the centered overflow at both edges.
<ScrollArea.Root
- css={STRIP_CONTAIN_CSS}
h={areThumbnailsVisible ? THUMBNAIL_STRIP_HEIGHT : '0'}
- minW="0"
opacity={areThumbnailsVisible ? 1 : 0}
pointerEvents={areThumbnailsVisible ? 'auto' : 'none'}
size="xs"