fix: ensure esc key does not close modals that are blocking #3033
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.
Description
The Paragon modal components (e.g.,
AlertModal
) generally rely on the underlyingModalDialog
component and it's optional props such asisBlocking
. The intent forisBlocking
should prevent the modal from being dismissed for use cases where there is a required action to be taken within the modal. However,isBlocking
only prevents clicking of the modal backdrop from dismissing modal; users may still press theEscape
key to dismiss the modal, despite the intent to have the modal be blocking.This PR ensures the
Escape
behavior whenisBlocking
is passed to modal components such asAlertModal
follows the same behavior as the modal backdrop; that is, when a modalisBlocking
, neither clicking the modal backdrop or pressingEscape
key should dismiss the modal.Deploy Preview
https://deploy-preview-3033--paragon-openedx.netlify.app/components/modal/alert-modal/
How to test:
isBlocking
prop to theAlertModal
component.Escape
key dismisses the blocking modal.Merge Checklist
example
app?wittjeff
andadamstankiewicz
as reviewers on this PR.Post-merge Checklist