Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(desktop-ui): disable all row Trigger buttons while the modal is open (H2)

Diego Zacarias0f52434c263b
diff --git a/desktop-app/ui/src/pages/WorkflowsPage.tsx b/desktop-app/ui/src/pages/WorkflowsPage.tsx
index 3896f6cb2..8eaa17631 100644
--- a/desktop-app/ui/src/pages/WorkflowsPage.tsx
+++ b/desktop-app/ui/src/pages/WorkflowsPage.tsx
@@ -82,10 +82,12 @@ function RecentRunsCell({
function WorkflowRow({
wf,
pendingTriggerKey,
+ triggerModalOpen,
onTrigger,
}: {
wf: WorkflowSummary
pendingTriggerKey: string | null
+ triggerModalOpen: boolean
onTrigger: (wf: WorkflowSummary) => void
}) {
const { setStatus } = useAuthContext()
@@ -149,7 +151,11 @@ function WorkflowRow({
<span className="action-row">
<Button
color="primary"
- disabled={!wf.triggerableByUser || anotherPending}
+ // While the Trigger modal is open, every row's Trigger is disabled:
+ // ConfirmDialog has no focus trap yet, so a keyboard user could
+ // otherwise Shift+Tab out and activate another row, resetting the
+ // modal's global selection state. (Central focus-trap is follow-up.)
+ disabled={!wf.triggerableByUser || anotherPending || triggerModalOpen}
loading={isTriggering}
onClick={() => onTrigger(wf)}
size="sm"
@@ -289,6 +295,7 @@ export function WorkflowsPage() {
key={workflowKey(wf)}
wf={wf}
pendingTriggerKey={pendingTriggerKey}
+ triggerModalOpen={triggerModalWorkflow !== null}
onTrigger={w => void handleTrigger(w)}
/>
))}
diff --git a/desktop-app/ui/src/pages/__tests__/WorkflowsPage.test.tsx b/desktop-app/ui/src/pages/__tests__/WorkflowsPage.test.tsx
index 5d277baf6..1c1af2394 100644
--- a/desktop-app/ui/src/pages/__tests__/WorkflowsPage.test.tsx
+++ b/desktop-app/ui/src/pages/__tests__/WorkflowsPage.test.tsx
@@ -166,6 +166,34 @@ describe('WorkflowsPage', () => {
expect(screen.queryByRole('dialog')).toBeNull()
})
+ // H2: while the Trigger modal is open, every row's Trigger button is disabled.
+ // ConfirmDialog has no focus trap, so a keyboard user could otherwise tab to
+ // another row and activate it, resetting the modal's global selection state.
+ it('disables every row Trigger button while the Trigger modal is open', async () => {
+ const WF_A = { ...WORKFLOW, name: 'recipe-a' }
+ const WF_B = { ...WORKFLOW, name: 'recipe-b' }
+ renderWorkflowsPage({
+ workflows: [WF_A, WF_B],
+ handleSelectWorkflow: vi.fn().mockResolvedValue(CONTRACT),
+ selectedWorkflowInputContract: CONTRACT,
+ })
+
+ const table = screen.getByRole('table')
+ const rowTriggers = within(table).getAllByRole('button', { name: 'Trigger' })
+ expect(rowTriggers).toHaveLength(2)
+ // Both enabled before the modal opens.
+ expect((rowTriggers[0] as HTMLButtonElement).disabled).toBe(false)
+ expect((rowTriggers[1] as HTMLButtonElement).disabled).toBe(false)
+
+ fireEvent.click(rowTriggers[0]!)
+ await screen.findByRole('dialog')
+
+ // With the modal open, every row Trigger is disabled (not just the opener).
+ for (const btn of within(table).getAllByRole('button', { name: 'Trigger' })) {
+ expect((btn as HTMLButtonElement).disabled).toBe(true)
+ }
+ })
+
it('does not fire trigger when the recipe declares no user on-demand trigger', () => {
const handleTriggerWorkflow = vi.fn()
renderWorkflowsPage({