Skip to content
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

[Dialog][Modal] Remove disableBackdropClick #23607

Merged
merged 6 commits into from
Nov 20, 2020

Conversation

eps1lon
Copy link
Member

@eps1lon eps1lon commented Nov 18, 2020

Breaking changes

  • [Dialog] Remove the disableBackdropClick prop. It's redundant with the reason argument.

    <Dialog
    - disableBackdropClick
    - onClose={handleClose}
    + onClose={(event, reason) => {
    +   if (reason !== 'backdropClick') {
    +     handleClose(event, reason);
    +   }
    + }}
    />
  • [Modal] Remove the disableBackdropClick prop. It's redundant with the reason argument.

    <Modal
    - disableBackdropClick
    - onClose={handleClose}
    + onClose={(event, reason) => {
    +   if (reason !== 'backdropClick') {
    +     handleClose(event, reason);
    +   }
    + }}
    />

disableEscapeKeyDown is on the chopping block as well but will be handed separately.

Also includes onEscapeKeydown migration guide as a follow-up to #23571

Affected demos:

@eps1lon eps1lon added breaking change component: dialog This is the name of the generic UI component, not the React module! component: modal This is the name of the generic UI component, not the React module! labels Nov 18, 2020
@eps1lon eps1lon changed the title Feat/modal/slim down [Dialog,Modal] Remove disableBackdropClick Nov 18, 2020
@mui-pr-bot
Copy link

mui-pr-bot commented Nov 18, 2020

Details of bundle changes

Generated by 🚫 dangerJS against 1cff479

Comment on lines -64 to -65
disableBackdropClick
disableEscapeKeyDown
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They don't have any effect on next either because we already have a fully custom onClose in ConfirmationDialogRaw

@eps1lon eps1lon marked this pull request as ready for review November 19, 2020 09:43
@oliviertassinari oliviertassinari changed the title [Dialog,Modal] Remove disableBackdropClick [Dialog][Modal] Remove disableBackdropClick Nov 19, 2020
@shiraze
Copy link

shiraze commented Aug 15, 2021

Shouldn't the example code still call handleClose(event)?

@oliviertassinari
Copy link
Member

oliviertassinari commented Aug 15, 2021

@shiraze Please be specific.

@shiraze
Copy link

shiraze commented Aug 15, 2021

I think initial code examples by @eps1lon should be:

Breaking changes

  • [Dialog] Remove the disableBackdropClick prop. It's redundant with the reason argument.
<Dialog
- disableBackdropClick
- onClose={handleClose}
+ onClose={(event, reason) => {
+   if (reason !== 'backdropClick') {
+     handleClose(event);
+   }
+ }}
/>
  • [Modal] Remove the disableBackdropClick prop. It's redundant with the reason argument.
<Modal
- disableBackdropClick
- onClose={handleClose}
+ onClose={(event, reason) => {
+   if (reason !== 'backdropClick') {
+     handleClose(event);
+   }
+ }}
/>

@oliviertassinari
Copy link
Member

Yes, updated, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change component: dialog This is the name of the generic UI component, not the React module! component: modal This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants