feat(a11y): add opt-in backdrop-click cancel to ConfirmDialog#189
Merged
mikewheeleer merged 1 commit intoJun 27, 2026
Conversation
Contributor
|
nice a11y touch — opt-in backdrop-click cancel is the right default. lgtm 🙌 |
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 #92
Add Optional, Accessible Backdrop-Click Dismissal to ConfirmDialog
Summary
This PR adds an opt-in backdrop-click dismissal mechanism to
ConfirmDialogwhile preserving the component's existing accessibility guarantees and keyboard interactions.A new
dismissOnBackdropprop allows consumers to enable modal dismissal by clicking outside the dialog panel. The implementation ensures that only genuine backdrop interactions trigger cancellation and that clicks originating inside the dialog do not.Problem
ConfirmDialogalready provides:However, the backdrop is currently non-interactive. Users who expect modal dialogs to close when clicking outside the dialog panel have no way to do so, and consumers cannot opt into this behavior.
Solution
Introduced an optional:
dismissOnBackdrop?: booleanprop that enables backdrop-click cancellation.
When enabled:
onCancelWhen disabled:
Changes
ConfirmDialog
Updated:
Changes include:
dismissOnBackdroppropTests
Extended:
Added coverage for:
Documentation
Updated component JSDoc to document:
dismissOnBackdropAccessibility Considerations
The implementation preserves:
role="dialog"aria-modalaria-labelledbyBackdrop interaction is additive and does not replace existing accessible dismissal methods.
Users can continue to dismiss the dialog using:
This ensures that backdrop interaction is never the sole dismissal mechanism.
Edge Cases Covered
dismissOnBackdrop={false}dismissOnBackdrop={true}Validation
Executed:
npm run lint npm run typecheck npm test npm run buildAcceptance Criteria
dismissOnBackdropproponCancelwhen enabled