Skip to content

Commit 0fc44e6

Browse files
authored
Fix(agentflow) - Fix z-index for validation button (#6238)
* Fix z-index for validation * Reverting changes to ValidationFeedback.tsx * Use tokens for z index
1 parent 1194c97 commit 0fc44e6

File tree

4 files changed

+21
-8
lines changed

4 files changed

+21
-8
lines changed

packages/agentflow/src/Agentflow.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ function AgentflowCanvas({
267267
position: 'absolute',
268268
left: showDefaultPalette ? 70 : 20, // 70px offset = ~10px gap between buttons
269269
top: 20,
270-
zIndex: 1001
270+
zIndex: tokens.zIndex.canvasButton
271271
}}
272272
>
273273
<IconSparkles />
@@ -276,7 +276,16 @@ function AgentflowCanvas({
276276

277277
{/* Canvas action buttons - positioned at top right */}
278278
{!readOnly && (
279-
<div style={{ position: 'absolute', right: 20, top: 20, zIndex: 1001, display: 'flex', gap: 8 }}>
279+
<div
280+
style={{
281+
position: 'absolute',
282+
right: 20,
283+
top: 20,
284+
zIndex: tokens.zIndex.canvasButton,
285+
display: 'flex',
286+
gap: 8
287+
}}
288+
>
280289
<ValidationFeedback
281290
nodes={nodes as FlowNode[]}
282291
edges={edges as FlowEdge[]}

packages/agentflow/src/core/theme/tokens.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,13 @@ export const tokens = {
256256
md: 8,
257257
lg: 12,
258258
round: '50%'
259+
},
260+
261+
// Z-index scale for canvas overlay elements.
262+
// All values sit below the Canvas Kit modal overlay (30–50).
263+
zIndex: {
264+
canvasButton: 10, // FABs and button containers
265+
canvasPanel: 20 // Open panels/poppers anchored to buttons
259266
}
260267
} as const
261268

packages/agentflow/src/features/canvas/components/ValidationFeedback.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ function ValidationFeedbackComponent({ nodes, edges, availableNodes, setNodes }:
151151
title='Validate flow'
152152
onClick={handleToggle}
153153
sx={{
154-
zIndex: 10,
155154
color: 'white',
156155
backgroundColor: 'primary.main',
157156
'&:hover': {
@@ -172,7 +171,7 @@ function ValidationFeedbackComponent({ nodes, edges, availableNodes, setNodes }:
172171
right: 0,
173172
mt: 1.5,
174173
width: 400,
175-
zIndex: 10
174+
zIndex: tokens.zIndex.canvasPanel
176175
}}
177176
>
178177
<Box sx={{ p: 2 }}>

packages/agentflow/src/features/node-palette/AddNodesDrawer.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ import { debounce, groupNodesByCategory, searchNodes } from './search'
3030
import { StyledFab } from './StyledFab'
3131
import { useDrawerMaxHeight } from './useDrawerMaxHeight'
3232

33-
const Z_INDEX_DRAWER = 10
34-
3533
export interface AddNodesDrawerProps {
3634
/** Available nodes to display */
3735
nodes: NodeDataSchema[]
@@ -154,7 +152,7 @@ function AddNodesDrawerComponent({ nodes, onDragStart, onNodeClick }: AddNodesDr
154152
position: 'absolute',
155153
left: 20,
156154
top: 20,
157-
zIndex: Z_INDEX_DRAWER
155+
zIndex: tokens.zIndex.canvasButton
158156
}}
159157
>
160158
{open ? <IconMinus /> : <IconPlus />}
@@ -177,7 +175,7 @@ function AddNodesDrawerComponent({ nodes, onDragStart, onNodeClick }: AddNodesDr
177175
}
178176
]
179177
}}
180-
sx={{ zIndex: Z_INDEX_DRAWER }}
178+
sx={{ zIndex: tokens.zIndex.canvasPanel }}
181179
>
182180
{({ TransitionProps }) => (
183181
<Fade {...TransitionProps} timeout={200}>

0 commit comments

Comments
 (0)