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): highlight selected preview thumbnail

joshistoast8fe9c9021973
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFilmstrip.tsx b/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFilmstrip.tsx
index 5029c71b95..dbb41d2867 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFilmstrip.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFilmstrip.tsx
@@ -114,8 +114,8 @@ const FilmstripThumb = ({
as="button"
aria-current={isSelected || undefined}
aria-label={item.kind === 'video' ? `Video ${item.name}` : item.name}
- borderColor={isSelected ? 'border.emphasized' : 'border.subtle'}
- borderWidth="1px"
+ borderColor={isSelected ? 'accent.solid' : 'border.subtle'}
+ borderWidth="2px"
boxSize={size}
cursor="pointer"
flexShrink={0}
@@ -130,7 +130,6 @@ const FilmstripThumb = ({
) : (
<Box aria-hidden bg="bg.muted" h="full" w="full" />
)}
- {isSelected ? <Box bg="accent.solid" bottom="0" h="2px" left="0" position="absolute" right="0" /> : null}
</Box>
);
};
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewMediaChrome.browser.test.tsx b/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewMediaChrome.browser.test.tsx
index 3c93f32606..ab37420977 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewMediaChrome.browser.test.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewMediaChrome.browser.test.tsx
@@ -2,7 +2,7 @@
import type { GalleryImageItem, GalleryVideoItem } from '@features/gallery';
import type { ImageActions } from '@workbench/image-actions';
-import { ChakraProvider, Text } from '@chakra-ui/react';
+import { Box, ChakraProvider, Text } from '@chakra-ui/react';
import { DndContext, PointerSensor, useDndMonitor, useSensor, useSensors, type DragStartEvent } from '@dnd-kit/core';
import { system } from '@theme/system';
import { createInstance } from 'i18next';
@@ -140,6 +140,34 @@ afterEach(async () => {
});
describe('PreviewFilmstrip mixed media', () => {
+ it('uses the gallery-style full accent border for the selected item', async () => {
+ await render(
+ <>
+ <Box borderColor="accent.solid" borderWidth="2px" data-filmstrip-selected-border-reference="" />
+ <DndContext>
+ <PreviewFilmstrip
+ density="full"
+ items={[sharedImage, sharedVideo]}
+ selectedItemKey="image:shared"
+ onSelect={() => undefined}
+ />
+ </DndContext>
+ </>
+ );
+
+ const reference = host!.querySelector<HTMLElement>('[data-filmstrip-selected-border-reference]')!;
+ const selected = host!.querySelector<HTMLButtonElement>('[aria-current="true"]')!;
+ const selectedStyle = getComputedStyle(selected);
+ const accentColor = getComputedStyle(reference).borderTopColor;
+
+ expect(selectedStyle.borderTopWidth).toBe('2px');
+ expect(selectedStyle.borderTopColor).toBe(accentColor);
+ expect(selectedStyle.borderRightColor).toBe(accentColor);
+ expect(selectedStyle.borderBottomColor).toBe(accentColor);
+ expect(selectedStyle.borderLeftColor).toBe(accentColor);
+ expect(selected.querySelector(':scope > div')).toBeNull();
+ });
+
it('keeps same-name media independent and selects the clicked video poster', async () => {
const onSelect = vi.fn();