Repository navigation
fix(BlacklistBulkRemoveConfirm): trap focus, block close mid-flight, … - #970
Merged
thlpkee20-wq merged 1 commit intoOct 22, 2026
Merged
thlpkee20-wq merged 1 commit into
thlpkee20-wq merged 1 commit into
Conversation
…and support onUndo
|
@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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.