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.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
fix(webv2): keep a floating window's settings gear in the title-bar strip
Lincoln Stein9abecc38761e
diff --git a/invokeai/frontend/webv2/src/workbench/widget-frame/FloatingWidgetWindow.browser.test.tsx b/invokeai/frontend/webv2/src/workbench/widget-frame/FloatingWidgetWindow.browser.test.tsxindex 84dbcc93bf..58d5f8099b 100644--- a/invokeai/frontend/webv2/src/workbench/widget-frame/FloatingWidgetWindow.browser.test.tsx+++ b/invokeai/frontend/webv2/src/workbench/widget-frame/FloatingWidgetWindow.browser.test.tsx@@ -7,7 +7,7 @@ import type {WidgetViewProps,} from '@workbench/widgetContracts';-import { ChakraProvider } from '@chakra-ui/react';+import { ChakraProvider, HStack } from '@chakra-ui/react';import { system } from '@theme/system';import { closeWorkbenchSettings, settingsDialogStore } from '@workbench/settings/settingsDialogStore';import i18next from 'i18next';@@ -86,10 +86,14 @@ const implementation: WidgetImplementation = {headerActions: ({ region }: WidgetViewProps) => {windowMocks.actionsRegion = region;+ // Widgets group their actions in a flex row, as the real header actions+ // do; the gear the window adds beside that group has to stay on its line.return (- <button aria-label="Toggle cluster labels" type="button">- <TagsIcon />- </button>+ <HStack gap="1">+ <button aria-label="Toggle cluster labels" type="button">+ <TagsIcon />+ </button>+ </HStack>);},headerMenu: () => <div data-testid="header-menu" />,@@ -200,6 +204,23 @@ describe('FloatingWidgetWindow chrome', () => {expect(host?.querySelector<HTMLButtonElement>('button[aria-label="Dock to panel"]')).not.toBeNull();});+ it('keeps the settings gear in the title-bar strip instead of beneath the widget actions', async () => {+ await renderWindow();++ const action = host!.querySelector<HTMLButtonElement>('button[aria-label="Toggle cluster labels"]')!;+ const gear = host!.querySelector<HTMLButtonElement>('button[aria-label="Image Map settings"]')!;+ const shade = host!.querySelector<HTMLButtonElement>('button[aria-label="Shade"]')!;+ const [actionRect, gearRect, shadeRect] = [action, gear, shade].map((button) => button.getBoundingClientRect());++ // A block-level wrapper around the slot laid the gear out under the+ // actions group — visibly a second row of chrome in the title bar.+ expect(gearRect.top).toBeLessThan(actionRect.bottom);+ expect(gearRect.bottom).toBeGreaterThan(actionRect.top);+ // Strip order: widget actions, then the gear, then the window's controls.+ expect(gearRect.left).toBeGreaterThanOrEqual(actionRect.right);+ expect(shadeRect.left).toBeGreaterThanOrEqual(gearRect.right);+ });+it('opens settings for the floating widget instance and remembers its gear for focus restoration', async () => {await renderWindow();const gear = host!.querySelector<HTMLButtonElement>('button[aria-label="Image Map settings"]')!;diff --git a/invokeai/frontend/webv2/src/workbench/widget-frame/FloatingWidgetWindow.tsx b/invokeai/frontend/webv2/src/workbench/widget-frame/FloatingWidgetWindow.tsxindex 98a6000212..e9b96ae857 100644--- a/invokeai/frontend/webv2/src/workbench/widget-frame/FloatingWidgetWindow.tsx+++ b/invokeai/frontend/webv2/src/workbench/widget-frame/FloatingWidgetWindow.tsx@@ -363,13 +363,16 @@ export const FloatingWidgetWindow = ({<HStack flexShrink={0} gap="1">{/* The widget's own header toggles: floated content renders bare, sowithout this the docked header's controls would simply vanish on- float. Frame-level actions stay out — this bar carries its own. */}+ float. Frame-level actions stay out — this bar carries its own.+ The slot yields siblings (the widget's actions group and the+ settings gear), so the wrapper is a row: as a block it stacked the+ gear under the actions instead of continuing the strip. */}{isEnabled && widget ? (<FloatingChromeBoundary><Suspense fallback={null}>- <Box onDoubleClick={stopChromeEvent} onPointerDown={stopChromeEvent}>+ <HStack gap="1" onDoubleClick={stopChromeEvent} onPointerDown={stopChromeEvent}><WidgetChromeSlotById instanceId={instanceId} region="floating" slot="viewActions" widget={widget} />- </Box>+ </HStack></Suspense></FloatingChromeBoundary>) : null}