Skip to content

fix(BlacklistBulkRemoveConfirm): trap focus, block close mid-flight, … - #970

Merged
thlpkee20-wq merged 1 commit into
RevoraOrg:masterfrom
samkelly-dev:fix/blacklist-bulk-remove-confirm
Oct 22, 2026
Merged

thlpkee20-wq merged 1 commit into
RevoraOrg:masterfrom
samkelly-dev:fix/blacklist-bulk-remove-confirm

Conversation

@samkelly-dev

Copy link
Copy Markdown
Contributor

Closes #942

Summary of Changes
Blocked Escape & Backdrop Close During Submission:
Updated the Escape keydown event listener and backdrop click handler in BlacklistBulkRemoveConfirm.tsx to prevent onClose() calls while isSubmitting is in-flight. If onConfirm fails, the dialog stays open and the error message alert is visible to the user.
Focus Management & Tab Trap:
Added a Tab and Shift+Tab focus trap cycling through all interactive/focusable elements within the dialog.
Preserved document.activeElement when the dialog opens and restored focus to the opener element when the dialog closes.
onUndo Prop Contract & Error Handling:
Added onUndo?: (entries: BlacklistEntry[]) => Promise | void; to BlacklistBulkRemoveConfirmProps.
Only registered the Undo banner action via registerUndo when onUndo is provided.
Wrapped onUndo(entries) in a try/catch block that surfaces errors via setSubmitError if undoing fails.
Comprehensive Test Coverage:
Added tests in BlacklistBulkRemoveConfirm.test.tsx verifying:
Escape key and backdrop clicks are ignored during pending confirm.
A failed confirm displays the error in the open dialog.
Focus is trapped within the dialog on Tab / Shift+Tab.
Focus returns to the trigger button when the dialog closes.
onUndo is called with the removed entries when Undo is clicked.
Undo banner is only registered when onUndo is provided.
Errors thrown by onUndo are caught and displayed.

@drips-wave

drips-wave Bot commented Oct 19, 2026

Copy link
Copy Markdown

@samkelly-dev Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@thlpkee20-wq
thlpkee20-wq merged commit d17f8f4 into RevoraOrg:master Oct 22, 2026
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.

fix(blacklist): bulk-remove confirm dialog can be closed mid-submit, has no focus trap, and its Undo is a console.log

2 participants