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
feat(ui): use the layers SegmentTabs strip for view and mode tabs
Josh Corbett1df629851575
diff --git a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryStackedLayout.tsx b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryStackedLayout.tsxindex ebf90e83a5..f7a1c963b3 100644--- a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryStackedLayout.tsx+++ b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryStackedLayout.tsx@@ -4,7 +4,8 @@ import {GALLERY_BOARD_PANEL_MIN_HEIGHT_PX,GALLERY_MIN_GRID_HEIGHT_PX,} from '@features/gallery/core/settings';-import { useCallback, useMemo, useRef, useState } from 'react';+import { segmentTabsPanelId, segmentTabsTabId } from '@platform/ui';+import { useCallback, useId, useMemo, useRef, useState } from 'react';import { useTranslation } from 'react-i18next';import { GalleryBoardsPanel } from './GalleryBoardsPanel';@@ -26,6 +27,7 @@ export const GalleryStackedLayout = () => {const { t } = useTranslation();const { actions, gallery } = useGalleryWidget();const { boardPanelCollapsed, boardPanelHeightPx } = gallery.settings;+ const viewTabsIdBase = useId();const [dragHeightPx, setDragHeightPx] = useState<number | null>(null);const [containerContentHeightPx, setContainerContentHeightPx] = useState<number | null>(null);const [controlsHeightPx, setControlsHeightPx] = useState<number | null>(null);@@ -121,7 +123,7 @@ export const GalleryStackedLayout = () => {)}<Stack ref={controlsRef} flexShrink={0} gap="2" minW="0"><HStack gap="1" minW="0">- <GalleryViewTabs />+ <GalleryViewTabs idBase={viewTabsIdBase} /><Spacer /><GalleryItemSortMenu /><GalleryUploadButton@@ -132,7 +134,15 @@ export const GalleryStackedLayout = () => {</HStack><GalleryItemSearch /></Stack>- <Flex data-gallery-grid-wrapper flex="1" minH={`${GALLERY_MIN_GRID_HEIGHT_PX}px`} minW="0">+ <Flex+ aria-labelledby={segmentTabsTabId(viewTabsIdBase, gallery.galleryView)}+ data-gallery-grid-wrapper+ flex="1"+ id={segmentTabsPanelId(viewTabsIdBase)}+ minH={`${GALLERY_MIN_GRID_HEIGHT_PX}px`}+ minW="0"+ role="tabpanel"+ ><GalleryImageGrid /></Flex></Stack>diff --git a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryViewTabs.browser.test.tsx b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryViewTabs.browser.test.tsxindex 31c52a5f50..d4b5d5139d 100644--- a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryViewTabs.browser.test.tsx+++ b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryViewTabs.browser.test.tsx@@ -24,8 +24,7 @@ afterEach(async () => {const renderViewTabs = async (): Promise<{counts: HTMLElement[];- indicator: HTMLElement;- items: HTMLElement[];+ tabs: HTMLElement[];}> => {host = document.createElement('div');document.body.append(host);@@ -44,34 +43,20 @@ const renderViewTabs = async (): Promise<{root?.render(<ChakraProvider value={system}><GalleryWidgetContext value={value}>- <GalleryViewTabs />+ <GalleryViewTabs idBase="gallery-view-tabs-test" /></GalleryWidgetContext></ChakraProvider>);});- // Match the release accessibility journey: wait until Ark has measured the- // moving indicator and removed its initial checked-item fallback styling.- await act(- () =>- new Promise<void>((resolve) => {- requestAnimationFrame(() =>- requestAnimationFrame(() => {- setTimeout(resolve, 200);- })- );- })- );-- const items = [...host.querySelectorAll<HTMLElement>('[data-part="item"]')];+ const tabs = [...host.querySelectorAll<HTMLElement>('[role="tab"]')];return {- // The count is the only span in an item whose text is purely numeric.- counts: items.map((item) =>- [...item.querySelectorAll<HTMLElement>('span')].find((span) => /^\d+$/.test(span.textContent!.trim()))!+ // The count is the only span in a tab whose text is purely numeric.+ counts: tabs.map((tab) =>+ [...tab.querySelectorAll<HTMLElement>('span')].find((span) => /^\d+$/.test(span.textContent!.trim()))!),- indicator: host.querySelector<HTMLElement>('[data-part="indicator"]')!,- items,+ tabs,};};@@ -82,17 +67,15 @@ describe('GalleryViewTabs', () => {expect(counts.map((count) => count.textContent)).toEqual(['148', '7']);});- it('keeps the count readable against the selected segment itself', async () => {- const { counts, items } = await renderViewTabs();- const checkedIndex = items.findIndex((item) => item.dataset.state === 'checked');- const count = counts[checkedIndex]!;+ it('keeps the count readable against the shown tab itself', async () => {+ const { counts, tabs } = await renderViewTabs();+ const shownIndex = tabs.findIndex((tab) => tab.getAttribute('aria-selected') === 'true');+ const count = counts[shownIndex]!;const style = getComputedStyle(count);- // Axe evaluates the selected item's own background rather than a moving- // indicator sibling behind it, so that local surface must carry the fill.const ratio = getContrastRatio(style.color,- getComputedStyle(items[checkedIndex]!).backgroundColor,+ getComputedStyle(tabs[shownIndex]!).backgroundColor,Number(style.opacity));diff --git a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryViewTabs.tsx b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryViewTabs.tsxindex 894806e4e5..1a5849d9cd 100644--- a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryViewTabs.tsx+++ b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryViewTabs.tsx@@ -1,7 +1,7 @@import type { GalleryView } from '@features/gallery/core/types';import { Text } from '@chakra-ui/react';-import { SegmentedControl } from '@platform/ui';+import { SegmentTabs } from '@platform/ui';import { useCallback, useMemo } from 'react';import { useTranslation } from 'react-i18next';@@ -15,53 +15,57 @@ const GALLERY_VIEW_TABS = [/*** Media / Assets, each carrying the selected board's count for that view so- * the split is legible before you switch.- *- * A segmented control rather than a tablist: this chooses which items the grid- * queries and owns no panel of its own. Real tabs publish `aria-controls`- * pointing at a tabpanel, and there is none to point at — the grid is a- * sibling slot each layout shell places independently.+ * the split is legible before you switch. The same `SegmentTabs` strip the+ * layer panes use; each layout shell wires the tabpanel by putting+ * `segmentTabsPanelId(idBase)` on its grid container.*/-export const GalleryViewTabs = () => {+export const GalleryViewTabs = ({ idBase }: { idBase: string }) => {const { t } = useTranslation();const { actions, gallery } = useGalleryWidget();const selectedBoard = gallery.boards.find((board) => board.id === gallery.selectedBoardId);- const handleViewChange = useCallback((value: string) => actions.setView(value as GalleryView), [actions]);+ // SegmentTabs re-fires selecting the active tab (its collapsible-toggle+ // affordance); a same-view write would only dirty the widget values.+ const handleViewChange = useCallback(+ (value: GalleryView) => {+ if (value !== gallery.galleryView) {+ actions.setView(value);+ }+ },+ [actions, gallery.galleryView]+ );- const options = useMemo(+ const tabs = useMemo(() =>GALLERY_VIEW_TABS.map(({ labelKey, value }) => {const count = selectedBoard ? getGalleryCountForView(selectedBoard, value) : null;return {+ id: value,label: (<Text as="span" display="flex" gap="1.5">{t(labelKey)}{count === null ? null : (- // Dimmed from the item's own text colour rather than pinned to- // `fg.muted`: the checked item swaps to `accent.contrast`, and a- // fixed muted grey is unreadable on the accent fill. 0.8 is the- // dimmest that still clears 4.5:1 in both states.+ // Dimmed from the tab's own text colour, so it tracks the+ // shown/idle swap; 0.8 stays comfortably legible on both.<Text as="span" color="currentColor" fontVariantNumeric="tabular-nums" opacity="0.8">{count}</Text>)}</Text>),- value,};}),[selectedBoard, t]);return (- <SegmentedControl+ <SegmentTabs+ activeId={gallery.galleryView}ariaLabel={t('common.view')}- isFullWidth={false}- options={options}- value={gallery.galleryView}- onChange={handleViewChange}+ idBase={idBase}+ tabs={tabs}+ onSelect={handleViewChange}/>);};diff --git a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryWideLayout.tsx b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryWideLayout.tsxindex 7c31c70cb6..a295caa1d9 100644--- a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryWideLayout.tsx+++ b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryWideLayout.tsx@@ -1,6 +1,7 @@import { Box, Flex, HStack, Spacer, Stack } from '@chakra-ui/react';import { GALLERY_BOARD_PANEL_MAX_WIDTH_PX, GALLERY_BOARD_PANEL_MIN_WIDTH_PX } from '@features/gallery/core/settings';-import { useCallback, useState } from 'react';+import { segmentTabsPanelId, segmentTabsTabId } from '@platform/ui';+import { useCallback, useId, useState } from 'react';import { useTranslation } from 'react-i18next';import { GalleryBoardsPanel } from './GalleryBoardsPanel';@@ -24,6 +25,7 @@ export const GalleryWideLayout = () => {const { t } = useTranslation();const { actions, gallery } = useGalleryWidget();const { boardPanelCollapsed, boardPanelWidthPx } = gallery.settings;+ const viewTabsIdBase = useId();const [dragWidthPx, setDragWidthPx] = useState<number | null>(null);const displayWidthPx = dragWidthPx ?? boardPanelWidthPx;@@ -64,7 +66,7 @@ export const GalleryWideLayout = () => {looking at the grid — find, order, add, configure — collects at theend, so the eye has one place to go. */}<HStack gap="1" minW="0" pb="2" pe="3" ps="3" pt={CHROME_INSET_PADDING_TOP}>- <GalleryViewTabs />+ <GalleryViewTabs idBase={viewTabsIdBase} /><Spacer /><Box flex="1" maxW="22rem" minW="9rem"><GalleryItemSearch />@@ -76,7 +78,17 @@ export const GalleryWideLayout = () => {onUploadFiles={actions.uploadFiles}/></HStack>- <Box flex="1" minH="0" minW="0" pb="2" pe="3" ps="3">+ <Box+ aria-labelledby={segmentTabsTabId(viewTabsIdBase, gallery.galleryView)}+ flex="1"+ id={segmentTabsPanelId(viewTabsIdBase)}+ minH="0"+ minW="0"+ pb="2"+ pe="3"+ ps="3"+ role="tabpanel"+ ><GalleryImageGrid /></Box><GallerySelectionBar />diff --git a/invokeai/frontend/webv2/src/features/generation/ui/promptFields/DynamicPromptsButton.tsx b/invokeai/frontend/webv2/src/features/generation/ui/promptFields/DynamicPromptsButton.tsxindex bd512c04f5..51f9477a5a 100644--- a/invokeai/frontend/webv2/src/features/generation/ui/promptFields/DynamicPromptsButton.tsx+++ b/invokeai/frontend/webv2/src/features/generation/ui/promptFields/DynamicPromptsButton.tsx@@ -7,7 +7,7 @@ import { useDynamicPrompts } from '@features/generation/ui/useDynamicPrompts';import { useWildcards } from '@features/generation/ui/useWildcards';import { IconButton } from '@platform/ui/Button';import { PopoverContent } from '@platform/ui/Popover';-import { SegmentedControl } from '@platform/ui/SegmentedControl';+import { SegmentTabs, segmentTabsPanelId, segmentTabsTabId } from '@platform/ui/SegmentTabs';import { Tooltip } from '@platform/ui/Tooltip';import { BracesIcon } from 'lucide-react';import { useCallback, useId, useMemo, useState } from 'react';@@ -35,6 +35,7 @@ export const DynamicPromptsButton = ({}: DynamicPromptsButtonProps) => {const { t } = useTranslation();const triggerId = useId();+ const tabsIdBase = useId();const [isOpen, setIsOpen] = useState(false);const [tab, setTab] = useState<'preview' | 'wildcards'>('preview');const expansion = useDynamicPrompts(positivePrompt, config);@@ -42,7 +43,7 @@ export const DynamicPromptsButton = ({const popoverIds = useMemo(() => ({ trigger: triggerId }), [triggerId]);const handleOpenChange = useCallback((event: { open: boolean }) => setIsOpen(event.open), []);- const handleTabChange = useCallback((value: string) => setTab(value === 'wildcards' ? 'wildcards' : 'preview'), []);+ const handleTabChange = useCallback((value: 'preview' | 'wildcards') => setTab(value), []);const closeWith = useCallback((apply: (value: string) => void) => (value: string) => {apply(value);@@ -55,8 +56,8 @@ export const DynamicPromptsButton = ({const tabItems = useMemo(() => [- { label: t('widgets.generate.dynamicPrompts.preview'), value: 'preview' },- { label: t('widgets.generate.dynamicPrompts.wildcards'), value: 'wildcards' },+ { id: 'preview' as const, label: t('widgets.generate.dynamicPrompts.preview') },+ { id: 'wildcards' as const, label: t('widgets.generate.dynamicPrompts.wildcards') },],[t]);@@ -106,31 +107,36 @@ export const DynamicPromptsButton = ({<Popover.Positioner><PopoverContent w="26rem"><Popover.Body p="2.5">- <Stack gap="2.5">- {/* Content width (`isFullWidth={false}` + `alignSelf`): stretched across- the popover the tabs read as a header band rather than a control. */}- <SegmentedControl- alignSelf="start"- isFullWidth={false}- options={tabItems}- value={tab}- onChange={handleTabChange}+ <Stack gap="1.5">+ <SegmentTabs+ activeId={tab}+ ariaLabel={t('widgets.generate.dynamicPrompts.title')}+ idBase={tabsIdBase}+ tabs={tabItems}+ onSelect={handleTabChange}/>- {tab === 'preview' ? (- <DynamicPromptsPanel- batchCount={batchCount}- config={config}- expansion={expansion}- showSyntaxHighlighting={showSyntaxHighlighting}- onUsePrompt={handleUsePrompt}- />- ) : (- <WildcardsPanel- catalog={catalog}- showSyntaxHighlighting={showSyntaxHighlighting}- onInsert={handleInsert}- />- )}+ <Stack+ aria-labelledby={segmentTabsTabId(tabsIdBase, tab)}+ gap="2.5"+ id={segmentTabsPanelId(tabsIdBase)}+ role="tabpanel"+ >+ {tab === 'preview' ? (+ <DynamicPromptsPanel+ batchCount={batchCount}+ config={config}+ expansion={expansion}+ showSyntaxHighlighting={showSyntaxHighlighting}+ onUsePrompt={handleUsePrompt}+ />+ ) : (+ <WildcardsPanel+ catalog={catalog}+ showSyntaxHighlighting={showSyntaxHighlighting}+ onInsert={handleInsert}+ />+ )}+ </Stack></Stack></Popover.Body></PopoverContent>diff --git a/invokeai/frontend/webv2/src/features/generation/ui/promptFields/DynamicPromptsControls.browser.test.tsx b/invokeai/frontend/webv2/src/features/generation/ui/promptFields/DynamicPromptsControls.browser.test.tsxindex fa9fd7e081..77d765d150 100644--- a/invokeai/frontend/webv2/src/features/generation/ui/promptFields/DynamicPromptsControls.browser.test.tsx+++ b/invokeai/frontend/webv2/src/features/generation/ui/promptFields/DynamicPromptsControls.browser.test.tsx@@ -89,13 +89,8 @@ const openPopover = async () => {});};-/**- * Segment labels intercept pointer events, so the visible text is the click- * target. i18n is not bootstrapped in browser tests, so labels render as keys —- * segments are addressed by their stable value instead.- */-const segmentLabel = (value: string) =>- document.querySelector(`[data-scope="segment-group"][data-part="item-text"][id$=":radio:label:${value}"]`);+/** i18n is not bootstrapped in browser tests, so tabs are addressed by their stable id. */+const tabButton = (id: string) => document.querySelector<HTMLElement>(`[role="tab"][id$="-tab-${id}"]`);const captureError = (event: ErrorEvent) => pageErrors.push(event.message);@@ -137,7 +132,7 @@ describe('dynamic prompts popover controls', () => {}expect(pageErrors).toEqual([]);- expect(segmentLabel('preview'), 'popover should still be mounted').toBeTruthy();+ expect(tabButton('preview'), 'popover should still be mounted').toBeTruthy();});it('sends a click on the seed label to the switch, not the number input', async () => {@@ -258,22 +253,11 @@ describe('dynamic prompts popover controls', () => {const summaryHeight = headerControl();await act(async () => {- await userEvent.click(segmentLabel('wildcards')!);+ await userEvent.click(tabButton('wildcards')!);});// The summary badge and the "New wildcard" button sit in the same slot on// either tab, so switching tabs must not change the header's shape.expect(headerControl()).toBe(summaryHeight);});-- it('keeps the tabs to their content width rather than stretching them', async () => {- await render(vi.fn());- await openPopover();-- const tabs = segmentLabel('preview')!.closest('[data-scope="segment-group"][data-part="root"]')!;-- // Asserting the computed alignment rather than a pixel width: browser tests- // render i18n keys, so the labels are not their real size here.- expect(getComputedStyle(tabs).alignSelf).toBe('start');- });});diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/GraphPreviewDialog.browser.test.tsx b/invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/GraphPreviewDialog.browser.test.tsxindex 9e5ea169a5..51ddbf4cf4 100644--- a/invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/GraphPreviewDialog.browser.test.tsx+++ b/invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/GraphPreviewDialog.browser.test.tsx@@ -430,13 +430,13 @@ describe('GraphPreviewDialog', () => {});const switchToMode = async (mode: 'graph' | 'list' | 'json') => {- const input = document.querySelector<HTMLInputElement>(`input[value="${mode}"]`);- expect(input).not.toBeNull();- const label = input?.closest('label');- expect(label).not.toBeNull();+ const tab = [...document.querySelectorAll<HTMLButtonElement>('[role="tab"]')].find((candidate) =>+ candidate.id.endsWith(`-tab-${mode}`)+ );+ expect(tab).not.toBeUndefined();await act(() => {- label?.click();+ tab?.click();});};@@ -560,14 +560,7 @@ describe('GraphPreviewDialog', () => {expect(document.querySelector('[data-flow-stub]')).not.toBeNull();- const jsonInput = document.querySelector<HTMLInputElement>('input[value="json"]');- expect(jsonInput).not.toBeNull();- const jsonLabel = jsonInput?.closest('label');- expect(jsonLabel).not.toBeNull();-- await act(() => {- jsonLabel?.click();- });+ await switchToMode('json');expect(document.querySelector('[data-flow-stub]')).toBeNull();expect(document.body.textContent ?? '').toContain('"denoise_latents"');@@ -622,7 +615,10 @@ describe('GraphPreviewDialog', () => {await clickButtonWithText('denoise_latents');// List selection reveals the node in graph mode, not list mode.- expect(document.querySelector<HTMLInputElement>('input[value="graph"]')?.checked).toBe(true);+ const graphTab = [...document.querySelectorAll<HTMLElement>('[role="tab"]')].find((candidate) =>+ candidate.id.endsWith('-tab-graph')+ );+ expect(graphTab?.getAttribute('aria-selected')).toBe('true');expect(document.querySelector('[data-flow-stub]')).not.toBeNull();const text = document.body.textContent ?? '';diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/GraphPreviewDialog.tsx b/invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/GraphPreviewDialog.tsxindex 1f701b884a..016a2e8148 100644--- a/invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/GraphPreviewDialog.tsx+++ b/invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/GraphPreviewDialog.tsx@@ -4,9 +4,9 @@ import type { ReactNode } from 'react';import { Box, Dialog, Icon, Portal, Stack, Text } from '@chakra-ui/react';import { useWorkflowGraphPreview } from '@features/workflow/ui/WorkflowUiContext';-import { Button, JsonPreview, SegmentedControl, toaster } from '@platform/ui';+import { Button, JsonPreview, SegmentTabs, segmentTabsPanelId, segmentTabsTabId, toaster } from '@platform/ui';import { CheckIcon, ChevronUpIcon, CopyIcon, TriangleAlertIcon } from 'lucide-react';-import { useCallback, useMemo, useRef, useState } from 'react';+import { useCallback, useId, useMemo, useRef, useState } from 'react';import { useTranslation } from 'react-i18next';import { GraphPreviewFlow } from './GraphPreviewFlow';@@ -34,14 +34,11 @@ interface GraphPreviewDialogProps {type PreviewMode = 'graph' | 'list' | 'json';-const MODE_VALUES: readonly PreviewMode[] = ['graph', 'list', 'json'];-const isPreviewMode = (value: string | null): value is PreviewMode => MODE_VALUES.includes(value as PreviewMode);-const modeItems = [{ labelKey: 'graphPreview.graph', value: 'graph' },{ labelKey: 'graphPreview.list', value: 'list' },{ labelKey: 'common.json', value: 'json' },-] as const;+] as const satisfies readonly { labelKey: string; value: PreviewMode }[];const COPY_RESET_DELAY_MS = 1500;const SELECT_AND_REVEAL_FIT_VIEW_OPTIONS = { duration: 150, maxZoom: 1 } as const;@@ -84,6 +81,7 @@ export const GraphPreviewDialog = ({}: GraphPreviewDialogProps) => {const { t } = useTranslation();const graphPreview = useWorkflowGraphPreview();+ const modeTabsIdBase = useId();const [mode, setMode] = useState<PreviewMode>('graph');const [selectedNodeId, setSelectedNodeId] = useState<string | null>(null);const [hasCopied, setHasCopied] = useState(false);@@ -110,11 +108,7 @@ export const GraphPreviewDialog = ({);const handleOpenChange = useCallback((event: { open: boolean }) => closeAndReset(event.open), [closeAndReset]);- const handleModeChange = useCallback((value: string) => {- if (isPreviewMode(value)) {- setMode(value);- }- }, []);+ const handleModeChange = useCallback((value: PreviewMode) => setMode(value), []);const closeDialog = useCallback(() => closeAndReset(false), [closeAndReset]);const invokeRoute = useCallback(() => {void graphPreview.invoke(sourceId).then((submitted) => {@@ -194,7 +188,7 @@ export const GraphPreviewDialog = ({.catch(() => toaster.create({ title: t('graphPreview.copyFailed'), type: 'error' }));}, [graph, t]);- const modeOptions = useMemo(() => modeItems.map((item) => ({ label: t(item.labelKey), value: item.value })), [t]);+ const modeTabs = useMemo(() => modeItems.map((item) => ({ id: item.value, label: t(item.labelKey) })), [t]);const jsonLabel = useMemo(() => t('graphPreview.graphJsonLabel', { title: sourceLabel }), [t, sourceLabel]);const subtitle = useMemo(() => {const compiledFrom = t('graphPreview.compiledFrom', { source: sourceLabel });@@ -224,9 +218,24 @@ export const GraphPreviewDialog = ({{subtitle}</Text></Stack>- <SegmentedControl isFullWidth={false} options={modeOptions} value={mode} onChange={handleModeChange} />+ <SegmentTabs+ activeId={mode}+ ariaLabel={t('graphPreview.title')}+ idBase={modeTabsIdBase}+ tabs={modeTabs}+ onSelect={handleModeChange}+ /></Dialog.Header>- <Dialog.Body display="flex" flex="1" flexDirection="column" gap="3" minH="0">+ <Dialog.Body+ aria-labelledby={segmentTabsTabId(modeTabsIdBase, mode)}+ display="flex"+ flex="1"+ flexDirection="column"+ gap="3"+ id={segmentTabsPanelId(modeTabsIdBase)}+ minH="0"+ role="tabpanel"+ >{hasInvalidReasons ? (<InvalidBanner><Text>diff --git a/invokeai/frontend/webv2/src/platform/ui/SegmentTabs.tsx b/invokeai/frontend/webv2/src/platform/ui/SegmentTabs.tsxindex 2e277fdd31..ae198640e7 100644--- a/invokeai/frontend/webv2/src/platform/ui/SegmentTabs.tsx+++ b/invokeai/frontend/webv2/src/platform/ui/SegmentTabs.tsx@@ -10,7 +10,8 @@ export const SEGMENT_TABS_HEIGHT_PX = 40;export interface SegmentTab<T extends string = string> {id: T;- label: string;+ /** Usually a string; gallery tabs carry a dimmed count span. */+ label: ReactNode;}/** Roving focus for a horizontal tablist: arrows cycle, Home/End jump. */@@ -117,7 +118,7 @@ const SegmentTabButton = <T extends string>({isSelected: boolean;/** Selected AND its panel is visible; a collapsed block keeps selection without the shown look. */isShown: boolean;- label: string;+ label: ReactNode;onSelect: (id: T) => void;}) => {const select = useCallback(() => onSelect(id), [id, onSelect]);