Skip to content

[Dialog][Modal] Remove disableBackdropClick#23607

Merged
oliviertassinari merged 6 commits into
mui:nextfrom
eps1lon:feat/Modal/slim-down
Nov 20, 2020
Merged

[Dialog][Modal] Remove disableBackdropClick#23607
oliviertassinari merged 6 commits into
mui:nextfrom
eps1lon:feat/Modal/slim-down

Conversation

@eps1lon

@eps1lon eps1lon commented Nov 18, 2020

Copy link
Copy Markdown
Member

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 Introduces changes that are not backward compatible. scope: dialog Changes related to the dialog. scope: modal Changes related to the modal. labels Nov 18, 2020
@eps1lon eps1lon changed the title Feat/modal/slim down [Dialog,Modal] Remove disableBackdropClick Nov 18, 2020
@mui-pr-bot

mui-pr-bot commented Nov 18, 2020

Copy link
Copy Markdown

Details of bundle changes

Generated by 🚫 dangerJS against 1cff479

Comment on lines -64 to -65
disableBackdropClick
disableEscapeKeyDown

Copy link
Copy Markdown
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

shiraze commented Aug 15, 2021

Copy link
Copy Markdown

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

@oliviertassinari

oliviertassinari commented Aug 15, 2021

Copy link
Copy Markdown
Member

@shiraze Please be specific.

@shiraze

shiraze commented Aug 15, 2021

Copy link
Copy Markdown

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
Copy Markdown
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 Introduces changes that are not backward compatible. scope: dialog Changes related to the dialog. scope: modal Changes related to the modal.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants