Skip to content

Harden dialog accessibility and prevent duplicate actions#22

Closed
Codex wants to merge 5 commits intomainfrom
codex/sub-pr-21
Closed

Harden dialog accessibility and prevent duplicate actions#22
Codex wants to merge 5 commits intomainfrom
codex/sub-pr-21

Conversation

@Codex
Copy link
Contributor

@Codex Codex AI commented Mar 7, 2026

Confirm dialog lacked focus management and UI actions could double-trigger on rapid input.

  • Dialog accessibility: added initial focus to confirm, focus trap, Escape honoring loading state, aria-describedby, and restores prior focus on close.
  • Toast queueing: keep only the last three toasts, clear timers for evicted items, still schedule new toast timeout.
  • Action queue: guard decideQueue with an in-flight set to stop concurrent decisions and duplicate toasts.
  • Dashboard payments: ref-based in-flight guard blocks rapid double “pay now” submissions while preserving UI state.

Example:

if (pendingDecisionsRef.current.has(id)) return;
pendingDecisionsRef.current.add(id);
try {
  await api.decideQueue(id, decision, sessionId.current);
  // ...
} finally {
  pendingDecisionsRef.current.delete(id);
}

@chatgpt-codex-connector
Copy link

Summary

  • Verified the finding in Dashboard.tsx and fixed the double-submit race by introducing a synchronous in-flight guard ref (payingIdRef) that is checked before execution and set immediately when confirmation starts. This prevents rapid re-entry before React state updates. ui/src/pages/Dashboard.tsxL1-L37
  • Kept the existing UI behavior by continuing to use payingId state for loading indicators, while making the ref the authoritative marker for request-in-flight logic. ui/src/pages/Dashboard.tsxL13-L16 ui/src/pages/Dashboard.tsxL34-L35 ui/src/pages/Dashboard.tsxL94-L95
  • Preserved existing success/error/toast/finally behavior and cleared the ref in finally so retries only become possible after the request completes. ui/src/pages/Dashboard.tsxL37-L53
  • Committed the change on the current branch with commit ab356f3, and created a follow-up PR record via the make_pr tool as requested.

Testing

  • npm --prefix ui run build

View task →

@Codex Codex AI changed the title [WIP] Add structured feedback and confirmation dialog for payments Harden toast lifecycle and confirm dialog accessibility Mar 7, 2026
@Codex Codex AI changed the title Harden toast lifecycle and confirm dialog accessibility Harden dialog accessibility and prevent duplicate actions Mar 7, 2026
Base automatically changed from feat/mcp-ui-polish-20260307 to main March 7, 2026 19:10
@chitcommit
Copy link
Contributor

Closing as superseded: this branch was cherry-picked into #21 (commit b0ca82f), so all related fixes are now tracked on the primary PR.

@chitcommit chitcommit closed this Mar 7, 2026
@chitcommit chitcommit deleted the codex/sub-pr-21 branch March 7, 2026 19:17
Copilot stopped work on behalf of chitcommit due to an error March 7, 2026 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants