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.

feat(ui): accent drop affordances for image inputs and board rows

Josh Corbett0d7f77c150ee
diff --git a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardRow.tsx b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardRow.tsx
index a1382aa6be..0e173ceee9 100644
--- a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardRow.tsx
+++ b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardRow.tsx
@@ -129,17 +129,23 @@ export const GalleryBoardRow = ({
return (
<Box
- // An outline rather than a border, so the drop affordance never reflows the list.
+ // An outline rather than a border, so the drop affordance never reflows
+ // the list; over the row it steps up to a solid inset ring.
bg={isOver ? 'accent.muted' : undefined}
- outline={canDropItems ? '1px dashed' : undefined}
+ outline={isOver ? '2px solid' : canDropItems ? '1px dashed' : undefined}
outlineColor={canDropItems ? 'accent.solid' : undefined}
+ // Inset keeps the ring inside the row; the selected row's opaque accent
+ // fill would cover it, so its ring stays outside where it reads.
+ outlineOffset={isOver && !isSelected ? '-2px' : undefined}
rounded="sm"
+ transition="background var(--wb-motion-duration-fast) ease"
w="full"
>
<GalleryBoardRowShell
ref={setNodeRef}
actions={actions}
cover={cover}
+ isDropTarget={canDropItems}
isSelected={isSelected}
label={boardLabel}
subtitle={subtitle}
diff --git a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardRowShell.tsx b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardRowShell.tsx
index e3bffbb29a..4cadfa1c04 100644
--- a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardRowShell.tsx
+++ b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardRowShell.tsx
@@ -20,6 +20,16 @@ const SELECTED_CONTAINER_CSS: SystemStyleObject = {
color: 'accent.contrast',
} as const;
+/**
+ * While a compatible drag targets the row, the container's own hover fill
+ * stands down: it would paint over the accent drop tint the row draws behind
+ * it, flashing it out right as the drag arrives.
+ */
+const DROP_TARGET_CONTAINER_CSS: SystemStyleObject = {
+ ...ROW_CONTAINER_CSS,
+ _hover: { bg: 'transparent' },
+} as const;
+
/** The container owns the fill, so the button contributes only its focus ring. */
const ROW_BUTTON_CSS = { _hover: { bg: 'transparent' }, bg: 'transparent' } as const;
@@ -33,6 +43,7 @@ export const GalleryBoardRowShell = ({
ariaLabel,
children,
cover,
+ isDropTarget = false,
isSelected = false,
label,
labelWeight,
@@ -47,6 +58,8 @@ export const GalleryBoardRowShell = ({
/** Trailing metadata rendered inside the row button (dates, counts, badges). */
children?: ReactNode;
cover: ReactNode;
+ /** A compatible drag is in flight and this row could receive it. */
+ isDropTarget?: boolean;
isSelected?: boolean;
label: string;
labelWeight?: string;
@@ -55,7 +68,10 @@ export const GalleryBoardRowShell = ({
onContextMenu?: (event: MouseEvent) => void;
onSelect: () => void;
}) => {
- const containerCss = useMemo(() => (isSelected ? SELECTED_CONTAINER_CSS : ROW_CONTAINER_CSS), [isSelected]);
+ const containerCss = useMemo(
+ () => (isSelected ? SELECTED_CONTAINER_CSS : isDropTarget ? DROP_TARGET_CONTAINER_CSS : ROW_CONTAINER_CSS),
+ [isDropTarget, isSelected]
+ );
return (
<HStack ref={ref} css={containerCss} gap="0" pe="1" w="full">
diff --git a/invokeai/frontend/webv2/src/features/generation/ui/reference-images/GenerateReferenceImagesSection.tsx b/invokeai/frontend/webv2/src/features/generation/ui/reference-images/GenerateReferenceImagesSection.tsx
index af8858ff1c..2da782df56 100644
--- a/invokeai/frontend/webv2/src/features/generation/ui/reference-images/GenerateReferenceImagesSection.tsx
+++ b/invokeai/frontend/webv2/src/features/generation/ui/reference-images/GenerateReferenceImagesSection.tsx
@@ -245,6 +245,7 @@ export const GenerateReferenceImagesContent = ({
flex="1"
fontSize="2xs"
gap="2"
+ isDisabled={!canAdd}
isOver={isOver}
justifyContent="center"
minH="12"
diff --git a/invokeai/frontend/webv2/src/features/upscale/ui/UpscaleImageField.tsx b/invokeai/frontend/webv2/src/features/upscale/ui/UpscaleImageField.tsx
index 609c923230..15d4781b5c 100644
--- a/invokeai/frontend/webv2/src/features/upscale/ui/UpscaleImageField.tsx
+++ b/invokeai/frontend/webv2/src/features/upscale/ui/UpscaleImageField.tsx
@@ -169,6 +169,7 @@ export const UpscaleImageField = memo(
as="button"
aria-busy={isLoading}
aria-label={inputImage ? t('widgets.upscale.replaceImage') : t('widgets.upscale.uploadImage')}
+ isDisabled={isLoading}
isOver={isOver}
{...(isLoading ? DROP_ZONE_BUSY_PROPS : undefined)}
minH="24"
diff --git a/invokeai/frontend/webv2/src/features/video/ui/VideoFrameImageField.tsx b/invokeai/frontend/webv2/src/features/video/ui/VideoFrameImageField.tsx
index b75541e345..f597f4db75 100644
--- a/invokeai/frontend/webv2/src/features/video/ui/VideoFrameImageField.tsx
+++ b/invokeai/frontend/webv2/src/features/video/ui/VideoFrameImageField.tsx
@@ -181,6 +181,7 @@ export const VideoFrameImageField = memo(
aria-disabled={disabled}
aria-label={image ? t('widgets.video.replaceFrame') : t('widgets.video.uploadFrame')}
cursor={disabled ? 'not-allowed' : undefined}
+ isDisabled={isInert}
isOver={isOver}
{...(isLoading ? DROP_ZONE_BUSY_PROPS : undefined)}
minH="20"
diff --git a/invokeai/frontend/webv2/src/features/video/ui/VideoReferenceListField.tsx b/invokeai/frontend/webv2/src/features/video/ui/VideoReferenceListField.tsx
index f2e111a6c5..9f9abf000b 100644
--- a/invokeai/frontend/webv2/src/features/video/ui/VideoReferenceListField.tsx
+++ b/invokeai/frontend/webv2/src/features/video/ui/VideoReferenceListField.tsx
@@ -47,7 +47,6 @@ const DROP_ZONE_FOCUS_PROPS = {
};
const DROP_ZONE_DISABLED_PROPS = { cursor: 'not-allowed', opacity: 0.6 };
const DROP_ZONE_BUSY_PROPS = { disabled: true };
-const DROP_ZONE_HOVER_PROPS = { bg: 'bg.muted', color: 'fg' };
const getSingleGalleryDragItem = (data: unknown): { kind: 'image' | 'video'; name: string } | null => {
if (!isGalleryItemDragData(data) || data.items.length !== 1) {
@@ -544,7 +543,8 @@ export const VideoReferenceListField = memo(function VideoReferenceListField({
ref={setNodeRef}
{...(isInert ? DROP_ZONE_DISABLED_PROPS : {})}
{...(isLoading ? DROP_ZONE_BUSY_PROPS : {})}
- {...(isOver && acceptsActiveDrag ? DROP_ZONE_HOVER_PROPS : {})}
+ isDisabled={isInert}
+ isOver={isOver && acceptsActiveDrag}
_focusVisible={DROP_ZONE_FOCUS_PROPS}
position="relative"
>
diff --git a/invokeai/frontend/webv2/src/features/video/ui/VideoSourceClipField.tsx b/invokeai/frontend/webv2/src/features/video/ui/VideoSourceClipField.tsx
index a650e0ae28..5ff805d259 100644
--- a/invokeai/frontend/webv2/src/features/video/ui/VideoSourceClipField.tsx
+++ b/invokeai/frontend/webv2/src/features/video/ui/VideoSourceClipField.tsx
@@ -229,6 +229,7 @@ export const VideoSourceClipField = memo(
aria-disabled={disabled}
aria-label={sourceVideo ? t('widgets.video.replaceClip') : t('widgets.video.uploadClip')}
cursor={disabled ? 'not-allowed' : undefined}
+ isDisabled={isInert}
isOver={isOver}
{...(isLoading ? DROP_ZONE_BUSY_PROPS : undefined)}
minH="24"
diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx b/invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx
index c154fd0f3f..e5609400fa 100644
--- a/invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx
+++ b/invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx
@@ -95,6 +95,9 @@ export interface WorkflowFieldInputProps {
const invalidProps = (invalid: boolean | undefined) => (invalid ? { 'aria-invalid': true } : {});
+// The media well's hover, matching DropZone's pointer-hover accent preview.
+const MEDIA_INPUT_HOVER_PROPS = { borderColor: 'accent.solid' };
+
const toFiniteNumber = (raw: string): number | null => {
if (raw.trim() === '') {
return null;
@@ -623,7 +626,9 @@ const MediaInput = ({ id, invalid, kind, onChange, value }: WorkflowFieldInputPr
justifyContent="center"
overflow="hidden"
rounded="sm"
+ transition="border-color var(--wb-motion-duration-fast) ease"
w="full"
+ _hover={MEDIA_INPUT_HOVER_PROPS}
>
{failedThumbnail !== mediaName ? (
<Image
@@ -663,7 +668,9 @@ const MediaInput = ({ id, invalid, kind, onChange, value }: WorkflowFieldInputPr
h="full"
justifyContent="center"
rounded="sm"
+ transition="border-color var(--wb-motion-duration-fast) ease"
w="full"
+ _hover={MEDIA_INPUT_HOVER_PROPS}
>
<Text color="fg.subtle" fontSize="xs">
{`Drop a ${config.noun} here`}
diff --git a/invokeai/frontend/webv2/src/platform/ui/DropZone.tsx b/invokeai/frontend/webv2/src/platform/ui/DropZone.tsx
index 6f36e4e85f..18b7e4312a 100644
--- a/invokeai/frontend/webv2/src/platform/ui/DropZone.tsx
+++ b/invokeai/frontend/webv2/src/platform/ui/DropZone.tsx
@@ -2,11 +2,14 @@ import type { BoxProps } from '@chakra-ui/react';
import type { Ref } from 'react';
import { Box } from '@chakra-ui/react';
+import { useMemo } from 'react';
const DROP_ZONE_TRANSITION =
'background var(--wb-motion-duration-fast) ease, border-color var(--wb-motion-duration-fast) ease, opacity var(--wb-motion-duration-fast) ease, box-shadow var(--wb-motion-duration-fast) ease';
export interface DropZoneProps extends BoxProps {
+ /** The zone cannot accept input right now; the hover preview stands down. */
+ isDisabled?: boolean;
/** A compatible drag is hovering the zone. */
isOver?: boolean;
/** Forwarded to the underlying element (e.g. dnd-kit's `setNodeRef`). */
@@ -20,24 +23,41 @@ export interface DropZoneProps extends BoxProps {
}
/**
- * The workbench drop-target look: dashed `border.emphasized` at rest,
+ * The workbench drop-target look: dashed `border.emphasized` at rest, an
+ * accent border on pointer hover previewing the drop treatment, and an
* `accent.solid` border over an `accent.muted` tint while a compatible drag
* hovers. Every drop zone and upload area composes this so drag affordances
* stay identical across the app; callers add their own icon/hint content,
* interaction handlers, and layout props.
*/
-export const DropZone = ({ children, isOver, variant = 'inline', ...boxProps }: DropZoneProps) => (
- <Box
- bg={isOver ? 'accent.muted' : variant === 'overlay' ? 'bg.muted/80' : undefined}
- borderColor={isOver ? 'accent.solid' : 'border.emphasized'}
- borderStyle="dashed"
- borderWidth={variant === 'overlay' ? '2px' : '1px'}
- boxShadow={isOver && variant === 'overlay' ? '0 0 0 1px {colors.accent.solid}' : undefined}
- color={isOver ? 'fg' : 'fg.muted'}
- rounded="md"
- transition={DROP_ZONE_TRANSITION}
- {...boxProps}
- >
- {children}
- </Box>
-);
+export const DropZone = ({ children, isDisabled, isOver, variant = 'inline', _hover, ...boxProps }: DropZoneProps) => {
+ // Merged here rather than spread: `:hover` stays live during a drag, so a
+ // consumer hover fill would otherwise paint over the drag-over treatment.
+ // The accent preview is for persistent inline zones only — overlays exist
+ // mid-drag, where dnd-kit's own `isOver` is the signal.
+ const hoverProps = useMemo(
+ () => ({
+ ...(variant === 'inline' && !isDisabled ? { borderColor: 'accent.solid' } : null),
+ ..._hover,
+ ...(isOver ? { bg: 'accent.muted', borderColor: 'accent.solid' } : null),
+ }),
+ [_hover, isDisabled, isOver, variant]
+ );
+
+ return (
+ <Box
+ bg={isOver ? 'accent.muted' : variant === 'overlay' ? 'bg.muted/80' : undefined}
+ borderColor={isOver ? 'accent.solid' : 'border.emphasized'}
+ borderStyle="dashed"
+ borderWidth={variant === 'overlay' ? '2px' : '1px'}
+ boxShadow={isOver && variant === 'overlay' ? '0 0 0 1px {colors.accent.solid}' : undefined}
+ color={isOver ? 'fg' : 'fg.muted'}
+ rounded="md"
+ transition={DROP_ZONE_TRANSITION}
+ _hover={hoverProps}
+ {...boxProps}
+ >
+ {children}
+ </Box>
+ );
+};