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): respect reduced motion during first paint

joshistoast36fe6816e09e
diff --git a/invokeai/frontend/webv2/index.html b/invokeai/frontend/webv2/index.html
index 822beac377..d5a772e46d 100644
--- a/invokeai/frontend/webv2/index.html
+++ b/invokeai/frontend/webv2/index.html
@@ -24,14 +24,17 @@
id = raw && JSON.parse(raw).state.account.preferences.themeId;
}
var colorScheme = themeColorSchemes[id];
+ var root = document.documentElement;
if (colorScheme) {
var isLight = colorScheme === 'light';
- var root = document.documentElement;
root.setAttribute('data-theme', id);
root.style.colorScheme = colorScheme;
root.classList.toggle('dark', !isLight);
root.classList.toggle('light', isLight);
}
+ if (localStorage.getItem('invokeai:v7:webv2:reduce-motion') === 'true') {
+ root.setAttribute('data-reduce-motion', 'true');
+ }
} catch (error) {
/* ignore malformed storage */
}
diff --git a/invokeai/frontend/webv2/src/theme/recipes.ts b/invokeai/frontend/webv2/src/theme/recipes.ts
index 0acfdb75e4..532f0be229 100644
--- a/invokeai/frontend/webv2/src/theme/recipes.ts
+++ b/invokeai/frontend/webv2/src/theme/recipes.ts
@@ -134,9 +134,11 @@ export const comboboxSlotRecipe = defineSlotRecipe({
/** Dialog chrome: panel surface with a hairline stroke. */
export const dialogSlotRecipe = defineSlotRecipe({
- slots: ['content'],
+ ...chakraSlotRecipes.dialog,
base: {
+ ...chakraSlotRecipes.dialog.base,
content: {
+ ...chakraSlotRecipes.dialog.base?.content,
borderColor: 'border.subtle',
borderWidth: '1px',
},
@@ -198,7 +200,7 @@ export const rowRecipe = defineRecipe({
display: 'flex',
gap: '2',
textAlign: 'start',
- transition: 'background 0.12s ease, color 0.12s ease',
+ transition: 'background var(--wb-motion-duration-fast) ease, color var(--wb-motion-duration-fast) ease',
w: 'full',
_hover: { bg: 'bg.muted' },
_focusVisible: { outline: '2px solid', outlineColor: 'accent.solid', outlineOffset: '-2px' },
@@ -270,7 +272,8 @@ export const themeCardRecipe = defineSlotRecipe({
overflow: 'hidden',
p: '3',
textAlign: 'left',
- transition: 'border-color 0.12s ease, background 0.12s ease, transform 0.12s ease',
+ transition:
+ 'border-color var(--wb-motion-duration-fast) ease, background var(--wb-motion-duration-fast) ease, transform var(--wb-motion-duration-fast) ease',
_hover: { borderColor: 'border.emphasized' },
_focusVisible: { outline: '2px solid', outlineColor: 'accent.solid', outlineOffset: '2px' },
},
diff --git a/invokeai/frontend/webv2/src/theme/system.ts b/invokeai/frontend/webv2/src/theme/system.ts
index 2db12f586a..5cd71391db 100644
--- a/invokeai/frontend/webv2/src/theme/system.ts
+++ b/invokeai/frontend/webv2/src/theme/system.ts
@@ -202,8 +202,11 @@ const themeConditions = Object.fromEntries(
NON_DEFAULT_THEMES.map((theme) => [conditionName(theme.id), `:root[data-theme=${theme.id}]`])
);
+const motionDurationToken = (base: string): TokenValue => ({ value: { base, _reduceMotion: '1ms' } });
+const motionAnimationToken = (base: string): TokenValue => ({ value: { base, _reduceMotion: 'none' } });
+
const config = defineConfig({
- conditions: themeConditions,
+ conditions: { ...themeConditions, reduceMotion: ':root[data-reduce-motion=true]' },
globalCss: {
'html, body, #root': {
height: '100%',
@@ -217,14 +220,24 @@ const config = defineConfig({
minWidth: '960px',
overflow: 'hidden',
},
- // Respect the "reduce motion" preference by neutralizing transitions/animations.
- '[data-reduce-motion="true"], [data-reduce-motion="true"] *, [data-reduce-motion="true"] *::before, [data-reduce-motion="true"] *::after':
- {
- animationDuration: '0.001ms !important',
- animationIterationCount: '1 !important',
- scrollBehavior: 'auto !important',
- transitionDuration: '0.001ms !important',
- },
+ ':root': {
+ '--wb-motion-duration-fast': '0.12s',
+ '--wb-motion-duration-medium': '0.15s',
+ '--wb-motion-duration-slow': '0.2s',
+ '--wb-motion-animation-iteration-count': 'infinite',
+ },
+ // Keep durations non-zero: Ark presence waits for animation lifecycle events.
+ // Chakra recipe motion is covered by conditional duration/animation tokens below.
+ ':root[data-reduce-motion="true"]': {
+ '--wb-motion-duration-fast': '1ms',
+ '--wb-motion-duration-medium': '1ms',
+ '--wb-motion-duration-slow': '1ms',
+ '--wb-motion-animation-iteration-count': '1',
+ scrollBehavior: 'auto !important',
+ },
+ ':root[data-reduce-motion="true"] .chakra-skeleton': {
+ animation: 'none !important',
+ },
},
theme: {
tokens: {
@@ -238,7 +251,22 @@ const config = defineConfig({
},
},
semanticTokens: {
+ animations: {
+ bounce: motionAnimationToken('bounce 1s infinite'),
+ ping: motionAnimationToken('ping 1s cubic-bezier(0, 0, 0.2, 1) infinite'),
+ pulse: motionAnimationToken('pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite'),
+ spin: motionAnimationToken('spin 1s linear infinite'),
+ },
colors: semanticColors,
+ durations: {
+ fastest: motionDurationToken('50ms'),
+ faster: motionDurationToken('100ms'),
+ fast: motionDurationToken('150ms'),
+ moderate: motionDurationToken('200ms'),
+ slow: motionDurationToken('300ms'),
+ slower: motionDurationToken('400ms'),
+ slowest: motionDurationToken('500ms'),
+ },
},
// Chrome-level overrides for Chakra's built-in components, so popover and
// dialog surfaces are consistent everywhere without per-instance props.
diff --git a/invokeai/frontend/webv2/src/workbench/ThemeController.tsx b/invokeai/frontend/webv2/src/workbench/ThemeController.tsx
index c9685c192f..55c307cc56 100644
--- a/invokeai/frontend/webv2/src/workbench/ThemeController.tsx
+++ b/invokeai/frontend/webv2/src/workbench/ThemeController.tsx
@@ -1,5 +1,5 @@
import { DEFAULT_THEME, THEMES_BY_ID } from '@theme/system';
-import { useEffect } from 'react';
+import { useLayoutEffect } from 'react';
import { useWorkbenchSettings } from './settings/store';
@@ -9,15 +9,16 @@ import { useWorkbenchSettings } from './settings/store';
* Theme switching is intentionally a DOM-attribute flip rather than a React
* re-theme: the semantic-token conditions in `theme/system.ts` key off
* `<html data-theme>`, so changing the attribute restyles the whole shell with
- * no component re-render. `data-reduce-motion` is read by the global CSS that
- * neutralizes transitions. Renders nothing.
+ * no component re-render. `data-reduce-motion` is read by global CSS motion
+ * tokens. Renders nothing.
*/
/**
- * Read by the pre-paint script in index.html. A dedicated key (rather than the
- * workbench snapshot, which is per-user on multi-user backends) so the first
- * paint can apply the last-used theme without knowing who is signed in.
+ * Read by the pre-paint script in index.html. Dedicated hint keys (rather than
+ * the workbench snapshot, which is per-user on multi-user backends) let first
+ * paint apply last-used appearance without knowing who is signed in.
*/
const THEME_HINT_STORAGE_KEY = 'invokeai:v7:webv2:theme';
+const REDUCE_MOTION_HINT_STORAGE_KEY = 'invokeai:v7:webv2:reduce-motion';
export const ThemeController = () => {
const { preferences, status } = useWorkbenchSettings();
@@ -26,7 +27,7 @@ export const ThemeController = () => {
// theme; applying the store's defaults here would flash and clobber it.
const hasResolved = status === 'ready' || status === 'error';
- useEffect(() => {
+ useLayoutEffect(() => {
if (!hasResolved) {
return;
}
@@ -48,7 +49,7 @@ export const ThemeController = () => {
}
}, [hasResolved, themeId]);
- useEffect(() => {
+ useLayoutEffect(() => {
if (!hasResolved) {
return;
}
@@ -60,6 +61,16 @@ export const ThemeController = () => {
} else {
delete root.dataset.reduceMotion;
}
+
+ try {
+ if (reduceMotion) {
+ window.localStorage.setItem(REDUCE_MOTION_HINT_STORAGE_KEY, 'true');
+ } else {
+ window.localStorage.removeItem(REDUCE_MOTION_HINT_STORAGE_KEY);
+ }
+ } catch {
+ // Storage unavailable — the next load just waits for settings to resolve.
+ }
}, [hasResolved, reduceMotion]);
return null;
diff --git a/invokeai/frontend/webv2/src/workbench/launchpad/NewProjectCard.tsx b/invokeai/frontend/webv2/src/workbench/launchpad/NewProjectCard.tsx
index a01ab6aefb..79e398afd7 100644
--- a/invokeai/frontend/webv2/src/workbench/launchpad/NewProjectCard.tsx
+++ b/invokeai/frontend/webv2/src/workbench/launchpad/NewProjectCard.tsx
@@ -15,7 +15,7 @@ export const NewProjectCard = () => (
minH="40"
position="relative"
rounded="lg"
- transition="border-color 0.15s ease, background 0.15s ease"
+ transition="border-color var(--wb-motion-duration-medium) ease, background var(--wb-motion-duration-medium) ease"
_hover={{ bg: 'bg.subtle', borderColor: 'border.emphasized' }}
>
<Link aria-label="Create new project" search={{ new: true }} style={{ inset: 0, position: 'absolute' }} to="/app" />
diff --git a/invokeai/frontend/webv2/src/workbench/launchpad/ProjectCard.tsx b/invokeai/frontend/webv2/src/workbench/launchpad/ProjectCard.tsx
index b1ffba7f89..175e3fa246 100644
--- a/invokeai/frontend/webv2/src/workbench/launchpad/ProjectCard.tsx
+++ b/invokeai/frontend/webv2/src/workbench/launchpad/ProjectCard.tsx
@@ -92,7 +92,7 @@ export const ProjectCard = ({ summary }: { summary: ProjectSummary }) => {
overflow="hidden"
position="relative"
rounded="lg"
- transition="border-color 0.15s ease, background 0.15s ease"
+ transition="border-color var(--wb-motion-duration-medium) ease, background var(--wb-motion-duration-medium) ease"
_hover={{ bg: 'bg.muted', borderColor: 'border.emphasized' }}
onContextMenu={(event) => {
event.preventDefault();
diff --git a/invokeai/frontend/webv2/src/workbench/launchpad/models/detail/ModelImageUpload.tsx b/invokeai/frontend/webv2/src/workbench/launchpad/models/detail/ModelImageUpload.tsx
index ca866c678a..34c0eafd9e 100644
--- a/invokeai/frontend/webv2/src/workbench/launchpad/models/detail/ModelImageUpload.tsx
+++ b/invokeai/frontend/webv2/src/workbench/launchpad/models/detail/ModelImageUpload.tsx
@@ -183,7 +183,7 @@ export const ModelImageUpload = ({
position="absolute"
right="1"
top="1"
- transition="opacity 0.12s ease"
+ transition="opacity var(--wb-motion-duration-fast) ease"
_groupFocusWithin={{ opacity: 1, pointerEvents: 'auto' }}
_groupHover={{ opacity: 1, pointerEvents: 'auto' }}
>
diff --git a/invokeai/frontend/webv2/src/workbench/launchpad/models/install-queue/InstallQueueBar.tsx b/invokeai/frontend/webv2/src/workbench/launchpad/models/install-queue/InstallQueueBar.tsx
index f8d780f604..0bbc555c1c 100644
--- a/invokeai/frontend/webv2/src/workbench/launchpad/models/install-queue/InstallQueueBar.tsx
+++ b/invokeai/frontend/webv2/src/workbench/launchpad/models/install-queue/InstallQueueBar.tsx
@@ -155,7 +155,10 @@ export const InstallQueueBar = () => {
{activeJobs.length}
</Badge>
) : null}
- <Collapsible.Indicator _open={{ transform: 'rotate(180deg)' }} transition="transform 0.2s">
+ <Collapsible.Indicator
+ _open={{ transform: 'rotate(180deg)' }}
+ transition="transform var(--wb-motion-duration-slow)"
+ >
<Icon as={ChevronUpIcon} boxSize="4" color="fg.subtle" flexShrink={0} />
</Collapsible.Indicator>
</Collapsible.Trigger>
diff --git a/invokeai/frontend/webv2/src/workbench/launchpad/nodes/activity/NodeActivityBar.tsx b/invokeai/frontend/webv2/src/workbench/launchpad/nodes/activity/NodeActivityBar.tsx
index c2a6f78a7c..5da484ca1b 100644
--- a/invokeai/frontend/webv2/src/workbench/launchpad/nodes/activity/NodeActivityBar.tsx
+++ b/invokeai/frontend/webv2/src/workbench/launchpad/nodes/activity/NodeActivityBar.tsx
@@ -71,7 +71,10 @@ export const NodeActivityBar = () => {
{installingCount}
</Badge>
) : null}
- <Collapsible.Indicator _open={{ transform: 'rotate(180deg)' }} transition="transform 0.2s">
+ <Collapsible.Indicator
+ _open={{ transform: 'rotate(180deg)' }}
+ transition="transform var(--wb-motion-duration-slow)"
+ >
<Icon as={ChevronUpIcon} boxSize="4" color="fg.subtle" flexShrink={0} />
</Collapsible.Indicator>
</Collapsible.Trigger>
diff --git a/invokeai/frontend/webv2/src/workbench/widget-frame/WidgetEnableMenu.tsx b/invokeai/frontend/webv2/src/workbench/widget-frame/WidgetEnableMenu.tsx
index c98a77e2ca..893f84cce3 100644
--- a/invokeai/frontend/webv2/src/workbench/widget-frame/WidgetEnableMenu.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widget-frame/WidgetEnableMenu.tsx
@@ -61,7 +61,7 @@ const getWidgetEnableMenuTriggerButton = (label: string, trigger: WidgetEnableMe
h={isBottom ? '5' : '9'}
justify="center"
rounded={isBottom ? 'sm' : 'md'}
- transition="background 0.12s ease, color 0.12s ease"
+ transition="background var(--wb-motion-duration-fast) ease, color var(--wb-motion-duration-fast) ease"
w={isBottom ? '5' : '9'}
_hover={{ bg: 'bg.muted' }}
>
diff --git a/invokeai/frontend/webv2/src/workbench/widget-frame/WidgetFrames.tsx b/invokeai/frontend/webv2/src/workbench/widget-frame/WidgetFrames.tsx
index 80ae9dcd00..ccc7c8eea6 100644
--- a/invokeai/frontend/webv2/src/workbench/widget-frame/WidgetFrames.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widget-frame/WidgetFrames.tsx
@@ -1,8 +1,10 @@
import type {
+ WidgetInstanceId,
WidgetInstanceContract,
WidgetManifest,
WidgetRegion,
WidgetRuntimeApi,
+ WidgetTypeId,
WorkbenchRegion,
} from '@workbench/types';
@@ -44,10 +46,14 @@ const clampSize = (region: WidgetRegion, sizePx: number): number => {
export const WidgetPanelFrame = ({
children,
+ instanceId,
region,
+ typeId,
}: {
children: ReactNode;
+ instanceId?: WidgetInstanceId;
region: Exclude<WidgetRegion, 'center'>;
+ typeId?: WidgetTypeId;
}) => {
const regionState = useActiveProjectSelector((project) => project.widgetRegions[region]);
const dispatch = useWorkbenchDispatch();
@@ -127,6 +133,8 @@ export const WidgetPanelFrame = ({
flexShrink={0}
overflow="hidden"
minW="0"
+ data-hotkey-widget-instance-id={instanceId}
+ data-hotkey-widget-type-id={typeId}
{...focusRegionProps}
{...(isBottom ? { h: `${displaySizePx}px`, w: 'full' } : { h: 'full', w: `${displaySizePx}px` })}
>
@@ -143,7 +151,7 @@ export const WidgetPanelFrame = ({
position="absolute"
role="separator"
tabIndex={0}
- transition="opacity 0.12s ease, background 0.12s ease"
+ transition="opacity var(--wb-motion-duration-fast) ease, background var(--wb-motion-duration-fast) ease"
zIndex="1"
{...(isBottom ? { h: '2', left: '0', right: '0', top: '-1' } : { bottom: '0', top: '0', w: '2' })}
{...(!isBottom ? (isLeft ? { right: '-1' } : { left: '-1' }) : {})}
diff --git a/invokeai/frontend/webv2/src/workbench/widget-frame/WidgetRegionDropOverlay.tsx b/invokeai/frontend/webv2/src/workbench/widget-frame/WidgetRegionDropOverlay.tsx
index 944f32e8c5..b3ef3c0bff 100644
--- a/invokeai/frontend/webv2/src/workbench/widget-frame/WidgetRegionDropOverlay.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widget-frame/WidgetRegionDropOverlay.tsx
@@ -23,7 +23,7 @@ export const WidgetRegionDropOverlay = ({
rounded="sm"
shadow={dropState.isAllowed && isOver ? '0 0 0 1px {colors.accent.solid}' : undefined}
top="0"
- transition="background 0.12s ease, border-color 0.12s ease, opacity 0.12s ease, box-shadow 0.12s ease"
+ 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"
zIndex="2"
/>
);
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasStagingControls.tsx b/invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasStagingControls.tsx
index 2f27ccd314..b57de14a72 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasStagingControls.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasStagingControls.tsx
@@ -43,7 +43,7 @@ export const CanvasStagingControls = ({
opacity={areThumbnailsVisible ? 1 : 0}
pointerEvents={areThumbnailsVisible ? 'auto' : 'none'}
size="xs"
- transition="height 0.2s ease, opacity 0.2s ease"
+ transition="height var(--wb-motion-duration-slow) ease, opacity var(--wb-motion-duration-slow) ease"
variant="hover"
w="full"
>
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/gallery/GalleryBoardSelect.tsx b/invokeai/frontend/webv2/src/workbench/widgets/gallery/GalleryBoardSelect.tsx
index b380e09dd2..d57e96fba1 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/gallery/GalleryBoardSelect.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/gallery/GalleryBoardSelect.tsx
@@ -432,7 +432,7 @@ const BoardRow = ({
flexShrink={0}
opacity={0}
size="2xs"
- transition="opacity 0.15s ease"
+ transition="opacity var(--wb-motion-duration-medium) ease"
variant="ghost"
onClick={(event) => {
event.preventDefault();
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/gallery/GalleryImageGrid.tsx b/invokeai/frontend/webv2/src/workbench/widgets/gallery/GalleryImageGrid.tsx
index cd77d32ec7..633970e44e 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/gallery/GalleryImageGrid.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/gallery/GalleryImageGrid.tsx
@@ -11,7 +11,16 @@ import { IconButton } from '@workbench/components/ui';
import { ImageContextMenu, type ImageContextMenuTarget } from '@workbench/image-actions';
import { useActiveProjectSelector, useWorkbenchDispatch } from '@workbench/WorkbenchContext';
import { StarIcon, UploadIcon } from 'lucide-react';
-import { useEffect, useLayoutEffect, useMemo, useRef, useState, type DragEvent, type MouseEvent } from 'react';
+import {
+ useEffect,
+ useEffectEvent,
+ useLayoutEffect,
+ useMemo,
+ useRef,
+ useState,
+ type DragEvent,
+ type MouseEvent,
+} from 'react';
import type { GalleryImageDragImage } from './galleryDnd';
import type { GalleryQueuePlaceholder } from './galleryStateView';
@@ -652,7 +661,7 @@ const GalleryThumbnail = ({
position="absolute"
size="2xs"
top="1"
- transition="opacity 0.15s ease"
+ transition="opacity var(--wb-motion-duration-medium) ease"
variant="solid"
zIndex="1"
onClick={(event) => {
@@ -671,7 +680,7 @@ const GalleryThumbnail = ({
pointerEvents="none"
position="absolute"
size="xs"
- transition="opacity 0.15s ease"
+ transition="opacity var(--wb-motion-duration-medium) ease"
variant="solid"
zIndex="1"
>
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/generate/shared/GenerateCollapsibleSection.tsx b/invokeai/frontend/webv2/src/workbench/widgets/generate/shared/GenerateCollapsibleSection.tsx
index 9be521a228..31bdacb7ac 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/generate/shared/GenerateCollapsibleSection.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/generate/shared/GenerateCollapsibleSection.tsx
@@ -13,7 +13,10 @@ export const GenerateCollapsibleSection = ({ label, defaultOpen, isOpen, childre
return (
<Collapsible.Root defaultOpen={defaultOpen} open={isOpen} bg="bg.muted/50" rounded="md" overflow="hidden">
<Collapsible.Trigger display="flex" gap={2} w="full" p={2} alignItems="center">
- <Collapsible.Indicator _open={{ transform: 'rotate(90deg)' }} transition="transform 0.2s">
+ <Collapsible.Indicator
+ _open={{ transform: 'rotate(90deg)' }}
+ transition="transform var(--wb-motion-duration-slow)"
+ >
<ChevronRightIcon size="14" />
</Collapsible.Indicator>
<Text
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/workflow/editor/EditorToolbar.tsx b/invokeai/frontend/webv2/src/workbench/widgets/workflow/editor/EditorToolbar.tsx
index c06b4d7da8..2ae4955b11 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/workflow/editor/EditorToolbar.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/workflow/editor/EditorToolbar.tsx
@@ -11,6 +11,7 @@ import {
ZoomInIcon,
ZoomOutIcon,
} from 'lucide-react';
+import { useId } from 'react';
/**
* The editor's single tool strip, docked to the left edge: interaction tools
@@ -42,6 +43,9 @@ export const EditorToolbar = ({
onToolChange: (tool: EditorTool) => void;
}) => {
const { fitView, zoomIn, zoomOut } = useReactFlow();
+ const reduceMotion = useWorkbenchReduceMotion();
+ const opacityTriggerId = useId();
+ const fitViewDuration = reduceMotion ? 0 : 300;
return (
<Box left="3" position="absolute" top="50%" transform="translateY(-50%)" zIndex="5">
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/workflow/editor/InvocationFlowNode.tsx b/invokeai/frontend/webv2/src/workbench/widgets/workflow/editor/InvocationFlowNode.tsx
index 3e399ab8fa..8e2c735457 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/workflow/editor/InvocationFlowNode.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/workflow/editor/InvocationFlowNode.tsx
@@ -129,10 +129,14 @@ const NodeProgressStrip = ({ execution }: { execution: NodeExecutionState | null
<Box
bg="brand.solid"
h="full"
- transition="width 0.2s ease"
+ transition="width var(--wb-motion-duration-slow) ease"
w={execution.progress === null ? 'full' : `${Math.round(execution.progress * 100)}%`}
{...(execution.progress === null
- ? { animationDuration: '1.2s', animationIterationCount: 'infinite', animationName: 'pulse' }
+ ? {
+ animationDuration: 'var(--wb-motion-duration-slow)',
+ animationIterationCount: 'var(--wb-motion-animation-iteration-count)',
+ animationName: 'pulse',
+ }
: {})}
/>
</Box>
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/workflow/editor/WorkflowEdge.tsx b/invokeai/frontend/webv2/src/workbench/widgets/workflow/editor/WorkflowEdge.tsx
index 9b080ac9d0..6e8889bb3c 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/workflow/editor/WorkflowEdge.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/workflow/editor/WorkflowEdge.tsx
@@ -49,7 +49,9 @@ const WorkflowEdgeComponent = ({
});
const edgeStyle: CSSProperties = {
...style,
- animation: selected ? 'dashdraw 0.5s linear infinite' : undefined,
+ animation: selected
+ ? 'dashdraw var(--wb-motion-duration-slow) linear var(--wb-motion-animation-iteration-count)'
+ : undefined,
stroke: edgeData.stroke,
strokeDasharray: selected ? '5' : edgeData.strokeDasharray,
strokeLinecap: 'round',
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/workflow/editor/WorkflowEditorView.tsx b/invokeai/frontend/webv2/src/workbench/widgets/workflow/editor/WorkflowEditorView.tsx
index 9855179715..d2c8d9515e 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/workflow/editor/WorkflowEditorView.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/workflow/editor/WorkflowEditorView.tsx
@@ -206,12 +206,14 @@ const WorkflowFlow = ({ runtime }: { runtime: WidgetRuntimeApi }) => {
return pendingSelection ? withNodeSelection(next, nextSelectedNodeIdSet) : next;
});
- setFlowEdges((current) => toFlowEdges(projectGraph, current, edgeType, nextSelectedNodeIdSet, invocationTemplates));
+ setFlowEdges((current) =>
+ toFlowEdges(projectGraph, current, edgeType, nextSelectedNodeIdSet, invocationTemplates, reduceMotion)
+ );
if (pendingSelection) {
reportNodeSelection(pendingSelection);
}
- }, [edgeType, invocationTemplates, projectGraph, selectedNodeIds]);
+ }, [edgeType, invocationTemplates, projectGraph, reduceMotion, selectedNodeIds]);
// Expose the instance to the widget header's actions (outside this provider).
useEffect(() => {
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/workflow/editor/flowAdapters.test.ts b/invokeai/frontend/webv2/src/workbench/widgets/workflow/editor/flowAdapters.test.ts
index 53f93258f9..a3701597d6 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/workflow/editor/flowAdapters.test.ts
+++ b/invokeai/frontend/webv2/src/workbench/widgets/workflow/editor/flowAdapters.test.ts
@@ -285,4 +285,14 @@ describe('flowAdapters identity preservation', () => {
expect(cleared[0]?.zIndex).toBeUndefined();
expect(cleared[0]?.style).toBeUndefined();
});
+
+ it('keeps selected-node edge styling but disables edge animation when motion is reduced', () => {
+ const doc = createDoc();
+ const highlighted = toFlowEdges(doc, [], 'default', new Set(['a']), undefined, true);
+
+ expect(highlighted[0]?.animated).toBeUndefined();
+ expect(highlighted[0]?.className).toBe('workflow-selected-node-edge');
+ expect(highlighted[0]?.zIndex).toBe(1000);
+ expect(highlighted[0]?.style).toEqual({ strokeWidth: 2 });
+ });
});
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/workflow/editor/flowAdapters.ts b/invokeai/frontend/webv2/src/workbench/widgets/workflow/editor/flowAdapters.ts
index dab9ec7377..71e0e1ed67 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/workflow/editor/flowAdapters.ts
+++ b/invokeai/frontend/webv2/src/workbench/widgets/workflow/editor/flowAdapters.ts
@@ -285,7 +285,8 @@ export const toFlowEdges = (
previousEdges: WorkflowFlowEdge[] = [],
edgeType: FlowEdgeType = 'default',
selectedNodeIds: Set<string> = EMPTY_NODE_IDS,
- templates?: InvocationTemplates
+ templates?: InvocationTemplates,
+ reduceMotion = false
): WorkflowFlowEdge[] => {
const previousById = new Map(previousEdges.map((edge) => [edge.id, edge]));
@@ -293,7 +294,7 @@ export const toFlowEdges = (
const previous = previousById.get(edge.id);
const data = getWorkflowEdgeData(document, edge, edgeType, templates);
const isConnectedToSelectedNode = selectedNodeIds.has(edge.source) || selectedNodeIds.has(edge.target);
- const animated = isConnectedToSelectedNode || undefined;
+ const animated = isConnectedToSelectedNode && !reduceMotion ? true : undefined;
const className = isConnectedToSelectedNode ? SELECTED_NODE_EDGE_CLASS : undefined;
const style = isConnectedToSelectedNode ? SELECTED_NODE_EDGE_STYLE : undefined;
const zIndex = isConnectedToSelectedNode ? 1000 : undefined;
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/workflow/editor/nodeChrome.ts b/invokeai/frontend/webv2/src/workbench/widgets/workflow/editor/nodeChrome.ts
index 4efc19986f..8bf9b270cb 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/workflow/editor/nodeChrome.ts
+++ b/invokeai/frontend/webv2/src/workbench/widgets/workflow/editor/nodeChrome.ts
@@ -16,6 +16,6 @@ export const getWorkflowNodeChromeProps = ({
borderColor: invalid ? 'red.solid' : running ? 'brand.solid' : 'border.emphasized',
borderWidth: '1px',
shadow: selected ? NODE_SELECTED_RING : running ? NODE_RUNNING_RING : 'sm',
- transition: 'border-color 0.12s ease, box-shadow 0.12s ease',
+ transition: 'border-color var(--wb-motion-duration-fast) ease, box-shadow var(--wb-motion-duration-fast) ease',
_hover: selected ? undefined : { shadow: NODE_HOVER_RING },
});
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/workflow/library/WorkflowLibraryDialog.tsx b/invokeai/frontend/webv2/src/workbench/widgets/workflow/library/WorkflowLibraryDialog.tsx
index de2bfb4b66..00715d3799 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/workflow/library/WorkflowLibraryDialog.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/workflow/library/WorkflowLibraryDialog.tsx
@@ -308,7 +308,7 @@ export const WorkflowLibraryDialog = ({
overflow="hidden"
px="1"
rounded="md"
- transition="background 0.12s ease"
+ transition="background var(--wb-motion-duration-fast) ease"
w="full"
>
<Box