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): interaction polish across search, presets, tooltips, and menus

Josh Corbettcc30eda9ee65
diff --git a/invokeai/frontend/webv2/src/features/generation/ui/GeneratePresetsPopover.tsx b/invokeai/frontend/webv2/src/features/generation/ui/GeneratePresetsPopover.tsx
index 5cc2c0b80d..8f7c297767 100644
--- a/invokeai/frontend/webv2/src/features/generation/ui/GeneratePresetsPopover.tsx
+++ b/invokeai/frontend/webv2/src/features/generation/ui/GeneratePresetsPopover.tsx
@@ -18,7 +18,7 @@ import {
Scrollable,
Tooltip,
} from '@platform/ui';
-import { BookmarkIcon, PencilIcon, PlusIcon, SearchIcon, Trash2Icon } from 'lucide-react';
+import { BookmarkIcon, CheckIcon, PencilIcon, PlusIcon, SearchIcon, Trash2Icon } from 'lucide-react';
import { useCallback, useId, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -82,7 +82,6 @@ const PresetRow = ({
return (
<HStack gap="0.5">
<Row
- active={isActive ? 'accent' : 'none'}
aria-current={isActive || undefined}
asChild
flex="1"
@@ -91,13 +90,16 @@ const PresetRow = ({
minW="0"
px="2"
rounded="control"
- _hover={isActive ? undefined : PRESET_ROW_HOVER_PROPS}
+ _hover={PRESET_ROW_HOVER_PROPS}
>
<button type="button" onClick={handleApply}>
- <Icon as={BookmarkIcon} boxSize="3.5" color={isActive ? 'accent.contrast' : 'fg.subtle'} flexShrink={0} />
- <Text flex="1" fontSize="xs" minW="0" textAlign="start" truncate>
+ <Icon as={BookmarkIcon} boxSize="3.5" color="fg.subtle" flexShrink={0} />
+ <Text flex="1" fontSize="xs" fontWeight={isActive ? '600' : undefined} minW="0" textAlign="start" truncate>
{preset.label}
</Text>
+ {/* The applied marker: a check, not a filled row — the popover
+ surface stays quiet and the accent stays an accent. */}
+ {isActive ? <Icon as={CheckIcon} boxSize="3.5" color="accent.fg" flexShrink={0} /> : null}
</button>
</Row>
<Tooltip content={t('common.rename')}>
diff --git a/invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.browser.test.tsx b/invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.browser.test.tsx
index b3e293b184..340d9e6688 100644
--- a/invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.browser.test.tsx
+++ b/invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.browser.test.tsx
@@ -95,6 +95,7 @@ describe('PromptTriggerPopover', () => {
// The hover pill's edge is what reads as the button's edge, so the box —
// not the padded text — lines up with the copy.
expect(Math.abs(messageBounds.left - actionBounds.left)).toBeLessThanOrEqual(1);
- expect(actionBounds.top - messageBounds.bottom).toBeLessThanOrEqual(8);
+ // One `2.5` stack step, the same rhythm as the image-to-prompt popover.
+ expect(actionBounds.top - messageBounds.bottom).toBeLessThanOrEqual(12);
});
});
diff --git a/invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx b/invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx
index 474308e7bc..460b124dd7 100644
--- a/invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx
+++ b/invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx
@@ -222,16 +222,23 @@ export const AddPromptTriggerButton = ({
onOpenPromptTriggerPicker: (anchorElement: HTMLElement) => void;
}) => {
const { t } = useTranslation();
+ // Not disabled while open like it used to be: the greyed button read as
+ // broken next to the other action popovers' expanded tint. The guard keeps
+ // the dismiss-then-click sequence from immediately reopening.
const handleClick = useCallback(
- (event: MouseEvent<HTMLButtonElement>) => onOpenPromptTriggerPicker(event.currentTarget),
- [onOpenPromptTriggerPicker]
+ (event: MouseEvent<HTMLButtonElement>) => {
+ if (!isOpen) {
+ onOpenPromptTriggerPicker(event.currentTarget);
+ }
+ },
+ [isOpen, onOpenPromptTriggerPicker]
);
return (
<Tooltip content={t('widgets.generate.addPromptTrigger')}>
<IconButton
+ aria-expanded={isOpen}
aria-label={t('widgets.generate.addPromptTrigger')}
- disabled={isOpen}
size="2xs"
variant="ghost"
onClick={handleClick}
@@ -341,8 +348,13 @@ export const PromptTriggerPopover = ({
const PromptTriggerEmptyState = () => {
const { t } = useTranslation();
+ // The same anatomy as the image-to-prompt popover's no-model branch:
+ // uppercase title, one subtle line, the model-manager button.
return (
- <Stack align="start" gap="1" px="1">
+ <Stack align="start" gap="2.5">
+ <Text color="fg.subtle" fontSize="2xs" fontWeight="700" textTransform="uppercase">
+ {t('widgets.generate.addPromptTrigger')}
+ </Text>
<Text color="fg.subtle" fontSize="xs">
{t('widgets.generate.noPromptTriggersAvailable')}
</Text>
diff --git a/invokeai/frontend/webv2/src/features/generation/ui/promptFields/PromptTemplatesPanel.tsx b/invokeai/frontend/webv2/src/features/generation/ui/promptFields/PromptTemplatesPanel.tsx
index 4a2a8e3885..38054ff184 100644
--- a/invokeai/frontend/webv2/src/features/generation/ui/promptFields/PromptTemplatesPanel.tsx
+++ b/invokeai/frontend/webv2/src/features/generation/ui/promptFields/PromptTemplatesPanel.tsx
@@ -3,7 +3,7 @@ import type { PromptTemplateRecord } from '@features/generation/data/promptTempl
import type { PromptTemplateCatalog } from '@features/generation/ui/usePromptTemplates';
import type { ChangeEvent } from 'react';
-import { Box, HStack, Input, Separator, Stack, Text } from '@chakra-ui/react';
+import { Box, HStack, Icon, Input, Separator, Stack, Text } from '@chakra-ui/react';
import { searchCatalog } from '@features/generation/core/catalogSearch';
import { PROMPT_TEMPLATE_PLACEHOLDER } from '@features/generation/core/promptTemplates';
import { toPromptTemplateSnapshot } from '@features/generation/data/promptTemplates';
@@ -22,7 +22,7 @@ import { ConfirmDialog } from '@platform/ui/ConfirmDialog';
import { Row } from '@platform/ui/Row';
import { Scrollable } from '@platform/ui/Scrollable';
import { Tooltip } from '@platform/ui/Tooltip';
-import { DownloadIcon, ImageIcon, PencilIcon, PlusIcon, TrashIcon, UploadIcon } from 'lucide-react';
+import { CheckIcon, DownloadIcon, ImageIcon, PencilIcon, PlusIcon, TrashIcon, UploadIcon } from 'lucide-react';
import { useCallback, useMemo, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -389,7 +389,6 @@ const TemplateRow = ({
return (
<HStack align="center" gap="1" pr="1">
<Row
- active={isActive ? 'accent' : 'none'}
aria-current={isActive || undefined}
asChild
flex="1"
@@ -398,24 +397,22 @@ const TemplateRow = ({
minW="0"
px="2"
py="1.5"
- rounded="sm"
- _hover={isActive ? undefined : TEMPLATE_ROW_HOVER_PROPS}
+ rounded="control"
+ _hover={TEMPLATE_ROW_HOVER_PROPS}
>
<button type="button" onClick={handleApply}>
<TemplateThumbnail template={template} />
<Stack align="start" flex="1" gap="0" minW="0">
- <Text
- as="span"
- color={isActive ? 'accent.contrast' : 'fg'}
- fontSize="xs"
- fontWeight={isActive ? '600' : '400'}
- >
+ <Text as="span" fontSize="xs" fontWeight={isActive ? '600' : '400'}>
{template.name}
</Text>
- <Text as="span" color={isActive ? 'accent.contrast' : 'fg.muted'} fontFamily="mono" fontSize="2xs" truncate>
+ <Text as="span" color="fg.muted" fontFamily="mono" fontSize="2xs" truncate>
{summary}
</Text>
</Stack>
+ {/* The applied marker: a check, not a filled row — the popover
+ surface stays quiet and the accent stays an accent. */}
+ {isActive ? <Icon as={CheckIcon} boxSize="3.5" color="accent.fg" flexShrink={0} /> : null}
</button>
</Row>
{onEdit ? (
diff --git a/invokeai/frontend/webv2/src/platform/ui/InputShell.tsx b/invokeai/frontend/webv2/src/platform/ui/InputShell.tsx
index b222fa66e7..2048c0fcc7 100644
--- a/invokeai/frontend/webv2/src/platform/ui/InputShell.tsx
+++ b/invokeai/frontend/webv2/src/platform/ui/InputShell.tsx
@@ -1,5 +1,5 @@
import type { BoxProps } from '@chakra-ui/react';
-import type { ReactNode, Ref } from 'react';
+import type { PointerEvent, ReactNode, Ref } from 'react';
import { Box } from '@chakra-ui/react';
import { inputShellInteraction } from '@theme/recipes';
@@ -12,6 +12,22 @@ export interface InputShellProps extends BoxProps {
endElement?: ReactNode;
}
+/** Chrome clicks focus the field like a native input; adornment controls keep their own clicks. */
+const focusInnerInput = (event: PointerEvent<HTMLDivElement>) => {
+ const target = event.target as HTMLElement;
+
+ if (target.closest('button, input, textarea, select, a')) {
+ return;
+ }
+
+ const input = event.currentTarget.querySelector<HTMLElement>('input, textarea, [contenteditable]');
+
+ if (input) {
+ event.preventDefault();
+ input.focus();
+ }
+};
+
/**
* The themed input's chrome for composite fields whose focusable element lives
* inside the frame — a transparent input under a rendered mirror, a query
@@ -27,13 +43,18 @@ export const InputShell = ({ children, endElement, ref, startElement, ...boxProp
borderRadius="control"
borderWidth="1px"
css={inputShellInteraction}
+ cursor="text"
display="flex"
gap="1.5"
h="7"
minW="0"
- px="2"
+ // Trailing icon buttons carry their own inset; full end padding pushes
+ // them visibly further from the border than the leading glyph sits.
+ pe={endElement ? '1' : '2'}
+ ps="2"
textStyle="xs"
w="full"
+ onPointerDown={focusInnerInput}
{...boxProps}
>
{startElement}
diff --git a/invokeai/frontend/webv2/src/platform/ui/theme/recipes.ts b/invokeai/frontend/webv2/src/platform/ui/theme/recipes.ts
index f808ccd1e8..9ac063a5b6 100644
--- a/invokeai/frontend/webv2/src/platform/ui/theme/recipes.ts
+++ b/invokeai/frontend/webv2/src/platform/ui/theme/recipes.ts
@@ -19,6 +19,9 @@ export const tooltipSlotRecipe = defineSlotRecipe({
borderWidth: '1px',
boxShadow: 'lg',
color: 'fg',
+ // Chakra's `fast` scale-fade drags on an annotation this small.
+ _open: { ...chakraSlotRecipes.tooltip.base?.content?._open, animationDuration: 'faster' },
+ _closed: { ...chakraSlotRecipes.tooltip.base?.content?._closed, animationDuration: 'faster' },
},
arrowTip: {
...chakraSlotRecipes.tooltip.base?.arrowTip,
@@ -190,7 +193,7 @@ export const buttonRecipe = defineRecipe({
size: {
...chakraRecipes.button.variants?.size,
xs: { ...chakraRecipes.button.variants?.size?.xs, h: '7', minW: '7' },
- sm: { ...chakraRecipes.button.variants?.size?.sm, h: '8', minW: '8', textStyle: 'xs' },
+ sm: { ...chakraRecipes.button.variants?.size?.sm, h: '8', minW: '8', px: '3', textStyle: 'xs' },
md: { ...chakraRecipes.button.variants?.size?.md, h: '9', minW: '9', textStyle: 'xs' },
},
variant: {
diff --git a/invokeai/frontend/webv2/src/workbench/shell/topbar/ProjectSwitcher.tsx b/invokeai/frontend/webv2/src/workbench/shell/topbar/ProjectSwitcher.tsx
index 85d434ffb5..6fdbf44b1d 100644
--- a/invokeai/frontend/webv2/src/workbench/shell/topbar/ProjectSwitcher.tsx
+++ b/invokeai/frontend/webv2/src/workbench/shell/topbar/ProjectSwitcher.tsx
@@ -1,5 +1,6 @@
import type { Project } from '@workbench/projectContracts';
import type { ProjectSummary } from '@workbench/projects/library';
+import type { MouseEvent } from 'react';
import { Icon, Menu, Portal, Stack, Text } from '@chakra-ui/react';
import { flushGenerateDrafts } from '@features/generation/react';
@@ -71,6 +72,15 @@ export const ProjectSwitcher = () => {
}
}, []);
+ // Right-click opens the same dropdown: the trigger IS this control's context.
+ const handleTriggerContextMenu = useCallback(
+ (event: MouseEvent<HTMLButtonElement>) => {
+ event.preventDefault();
+ handleMenuOpenChange({ open: true });
+ },
+ [handleMenuOpenChange]
+ );
+
const getProject = useCallback((projectId: string): Project | null => queries.getProject(projectId), [queries]);
const createProject = useCallback(() => {
@@ -168,6 +178,7 @@ export const ProjectSwitcher = () => {
aria-label={t('topbar.projectSwitcher.trigger', { name: activeProjectName })}
size="sm"
variant="ghost"
+ onContextMenu={handleTriggerContextMenu}
>
<MiddleTruncate css={HIDE_BELOW_PROJECT_NAME_WIDTH} fontWeight="500" minW="0" text={activeProjectName} />
<Icon as={ChevronsUpDownIcon} boxSize="3" color="fg.subtle" flexShrink={0} />