-
Notifications
You must be signed in to change notification settings - Fork 535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trigger onClose when Dialog backdrop is clicked #4613
Conversation
🦋 Changeset detectedLatest commit: 9c35602 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
size-limit report 📦
|
wanted to bump you @keithamus when you have a sec 👀 For context, this was the PR for closing when the backdrop is clicked. You had proposed an alternate way for this but I'm not sure what that would look like. If you have a sec, or want to pair, would appreciate it a ton |
The web platform will provide |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great to me!
I can certainly see @keithamus argument for staying within the API of the web platform, and honestly I can't think of a reason I'd distinguish between a close button, esc key, and a background click. I could potentially see the need for cancel vs confirm type actions. I suspect in web platform terms the event target could be used to make these distinctions? The same could be done in the react world right?
Still it seems like the removal of "gestures" would be a breaking API change and need not hold up this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM
@@ -98,9 +98,9 @@ export interface DialogProps extends SxProp { | |||
|
|||
/** | |||
* This method is invoked when a gesture to close the dialog is used (either | |||
* an Escape key press or clicking the "X" in the top-right corner). The | |||
* an Escape key press, clicking the backdrop, or clicking the "X" in the top-right corner). The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this reference to clicking the backdrop be removed since that information isn't actually communicated?
Note
This is a re-open of #4565 which was reverted as part of the last release
Relates to https://github.com/github/primer/issues/2531
Relates to https://github.com/github/repos/issues/9248
Alternative to https://github.com/github/primer/issues/1838
I'd like to allow the v2 Dialog to be closed by clicking on the backdrop overlay. This is currently not supported, though the v1 Dialog and PVC dialog support this behavior.
Based on the usage guidelines, there are some unique cases where clicking the backdrop should not close the dialog. By passing in a new
backdrop
gesture, there is an escape hatch for these unique cases to ignorebackdrop
events on a case-by-case basis.Changelog
New
Dialog and ConfirmationDialog can now be closed by clicking on the backdrop round the dialog. This will cause
onClose
to be called with a new'backdrop'
gesture.Changed
Removed
Rollout strategy
Testing & Reviewing
Merge checklist