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(ui): sortables compose the fill fade dnd-kit's inline transition froze

Josh Corbettb7a84d0355b5
diff --git a/invokeai/frontend/webv2/src/workbench/shell/topbar/LayoutPresetManagerDialogBody.tsx b/invokeai/frontend/webv2/src/workbench/shell/topbar/LayoutPresetManagerDialogBody.tsx
index ef23b5e149..5f691105b1 100644
--- a/invokeai/frontend/webv2/src/workbench/shell/topbar/LayoutPresetManagerDialogBody.tsx
+++ b/invokeai/frontend/webv2/src/workbench/shell/topbar/LayoutPresetManagerDialogBody.tsx
@@ -23,6 +23,9 @@ import { useTranslation } from 'react-i18next';
import { resolveLayoutPresetIcon } from './layoutPresetIcons';
import { closeLayoutPresetManager, openLayoutPresetDelete, openLayoutPresetEdit } from './layoutPresetManagerStore';
+const ROW_FILL_TRANSITION =
+ 'background var(--chakra-durations-faster) ease, border-color var(--chakra-durations-faster) ease, color var(--chakra-durations-faster) ease';
+
const DND_MODIFIERS = [restrictToVerticalAxis, restrictToParentElement];
const POINTER_SENSOR_OPTIONS = { activationConstraint: { distance: 6 } } as const;
const KEYBOARD_SENSOR_OPTIONS = {
@@ -122,7 +125,9 @@ const PresetRow = ({ isOverridden, preset }: { isOverridden: boolean; preset: La
opacity: isDragging ? 0.5 : undefined,
position: 'relative' as const,
transform: CSS.Translate.toString(transform),
- transition,
+ // Compose the hover-fill fade back in: dnd-kit's inline transform
+ // transition otherwise replaces the CSS transition (see LayoutPresetStrip).
+ transition: [transition, ROW_FILL_TRANSITION].filter(Boolean).join(', '),
zIndex: isDragging ? 1 : undefined,
}),
[isDragging, transform, transition]
diff --git a/invokeai/frontend/webv2/src/workbench/shell/topbar/LayoutPresetStrip.tsx b/invokeai/frontend/webv2/src/workbench/shell/topbar/LayoutPresetStrip.tsx
index 2241b675f5..0f0ffbaff5 100644
--- a/invokeai/frontend/webv2/src/workbench/shell/topbar/LayoutPresetStrip.tsx
+++ b/invokeai/frontend/webv2/src/workbench/shell/topbar/LayoutPresetStrip.tsx
@@ -53,6 +53,8 @@ import { useActiveLayoutPresetId, useLayoutDrift } from './useLayoutDrift';
import { useTopbarShortcut } from './useTopbarShortcut';
const PRESET_MENU_ATTRIBUTE = 'data-preset-menu';
+const TAB_FILL_TRANSITION =
+ 'background var(--chakra-durations-faster) ease, border-color var(--chakra-durations-faster) ease, color var(--chakra-durations-faster) ease';
const PRESET_SCROLL_CSS = { '&::-webkit-scrollbar': { display: 'none' }, scrollbarWidth: 'none' } as const;
const PRESET_TAB_KEYS_BLOCKED_DURING_DRAG = new Set(['ArrowDown', 'ArrowLeft', 'ArrowRight', 'End', 'Home']);
const DND_MODIFIERS = [restrictToHorizontalAxis, restrictToParentElement];
@@ -282,7 +284,10 @@ const PresetTab = ({
opacity: isDragging ? 0.5 : undefined,
position: 'relative' as const,
transform: CSS.Translate.toString(transform),
- transition,
+ // dnd-kit's inline transform transition replaces the recipe's CSS
+ // transition outright, which froze hover/selected fills; compose the
+ // buttons' fill fade back in (motion-aware duration token).
+ transition: [transition, TAB_FILL_TRANSITION].filter(Boolean).join(', '),
zIndex: isDragging ? 1 : undefined,
}),
[isDragging, transform, transition]
diff --git a/invokeai/frontend/webv2/src/workbench/widget-frame/useWidgetSortable.ts b/invokeai/frontend/webv2/src/workbench/widget-frame/useWidgetSortable.ts
index e34503b33f..43a475a532 100644
--- a/invokeai/frontend/webv2/src/workbench/widget-frame/useWidgetSortable.ts
+++ b/invokeai/frontend/webv2/src/workbench/widget-frame/useWidgetSortable.ts
@@ -7,6 +7,9 @@ import { CSS } from '@dnd-kit/utilities';
import { getWidgetInstanceDragData, getWidgetInstanceDragId } from '@workbench/widgetDnd';
import { useCallback } from 'react';
+const WIDGET_FILL_TRANSITION =
+ 'background var(--chakra-durations-faster) ease, border-color var(--chakra-durations-faster) ease, color var(--chakra-durations-faster) ease';
+
export const useWidgetSortable = ({
disabled,
instanceId,
@@ -70,6 +73,12 @@ export const useWidgetSortable = ({
onKeyDownCapture: handleSemanticKeyDownCapture,
},
setNodeRef: setSortableNodeRef,
- style: { transform: CSS.Transform.toString(transform), transition },
+ style: {
+ transform: CSS.Transform.toString(transform),
+ // dnd-kit's inline transform transition replaces the CSS transition
+ // outright, which froze the chips' hover fills; compose the fill fade
+ // back in (motion-aware duration token).
+ transition: [transition, WIDGET_FILL_TRANSITION].filter(Boolean).join(', '),
+ },
};
};