Skip to content

Comments

[dialog][modal] Remove disableEscapeKeyDown prop#47695

Merged
silviuaavram merged 8 commits intomui:masterfrom
silviuaavram:feat/remove-disable-escape-key-down-prop
Feb 20, 2026
Merged

[dialog][modal] Remove disableEscapeKeyDown prop#47695
silviuaavram merged 8 commits intomui:masterfrom
silviuaavram:feat/remove-disable-escape-key-down-prop

Conversation

@silviuaavram
Copy link
Member

Remove the disableEscapeKeyDown from useModal, Modal and Dialog. Change the tests to reflect the change. Change the API docs and relevant examples.

Fixes #27306.

Copilot AI review requested due to automatic review settings January 29, 2026 09:40
@silviuaavram silviuaavram 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 Jan 29, 2026
@mui-bot
Copy link

mui-bot commented Jan 29, 2026

Netlify deploy preview

Bundle size report

Bundle Parsed size Gzip size
@mui/material ▼-164B(-0.03%) ▼-51B(-0.03%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/system 0B(0.00%) 0B(0.00%)
@mui/utils 0B(0.00%) 0B(0.00%)

Details of bundle changes

Generated by 🚫 dangerJS against e583e0f

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR removes the disableEscapeKeyDown prop from Modal, Dialog, and useModal components, aligning with the previous removal of disableBackdropClick. Users should now handle escape key behavior by checking the reason parameter in the onClose callback, providing a more consistent and flexible API design.

Changes:

  • Removed disableEscapeKeyDown prop from Modal, Dialog, and useModal type definitions and implementations
  • Updated tests to demonstrate the new pattern of handling escape key behavior via the onClose callback
  • Updated API documentation JSON files and examples to remove references to the deprecated prop

Reviewed changes

Copilot reviewed 10 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/mui-material/src/Modal/useModal.types.ts Removed disableEscapeKeyDown prop type definition
packages/mui-material/src/Modal/useModal.ts Removed conditional check for disableEscapeKeyDown, now always calls onClose with escapeKeyDown reason
packages/mui-material/src/Modal/Modal.test.js Updated tests to show how to disable escape key behavior via onClose callback filtering
packages/mui-material/src/Modal/Modal.js Removed disableEscapeKeyDown prop and its PropTypes definition
packages/mui-material/src/Modal/Modal.d.ts Removed disableEscapeKeyDown from TypeScript interface
packages/mui-material/src/Dialog/Dialog.test.js Updated test to filter both backdropClick and escapeKeyDown in the onClose handler
packages/mui-material/src/Dialog/Dialog.js Removed disableEscapeKeyDown prop, its default value, and PropTypes definition
packages/mui-material/src/Dialog/Dialog.d.ts Removed disableEscapeKeyDown from TypeScript interface
docs/pages/material-ui/api/modal.json Removed disableEscapeKeyDown from API documentation
docs/pages/material-ui/api/dialog.json Removed disableEscapeKeyDown from API documentation
docs/data/material/components/selects/DialogSelect.tsx Updated example to filter both backdropClick and escapeKeyDown in handleClose, removed disableEscapeKeyDown prop usage
docs/data/material/components/selects/DialogSelect.js Updated example to filter both backdropClick and escapeKeyDown in handleClose, removed disableEscapeKeyDown prop usage

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@silviuaavram silviuaavram self-assigned this Feb 17, 2026
Copy link
Member

@ZeeshanTamboli ZeeshanTamboli left a comment

Choose a reason for hiding this comment

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

Copy link
Member

@siriwatknp siriwatknp left a comment

Choose a reason for hiding this comment

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

Please update this page https://next.mui.com/material-ui/migration/upgrade-to-v9/ to include this breaking change with the migration.

@silviuaavram silviuaavram force-pushed the feat/remove-disable-escape-key-down-prop branch from 4028856 to 8386e95 Compare February 19, 2026 09:07
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Feb 19, 2026
@silviuaavram silviuaavram force-pushed the feat/remove-disable-escape-key-down-prop branch from 06f5c0a to b4911ac Compare February 19, 2026 09:29
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Feb 19, 2026
@ZeeshanTamboli ZeeshanTamboli changed the title [Dialog][Modal] Remove disableEscapeKeyDown [dialog][modal] Remove disableEscapeKeyDown prop Feb 19, 2026
Copy link
Member

@ZeeshanTamboli ZeeshanTamboli left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@silviuaavram silviuaavram merged commit 28d01ff into mui:master Feb 20, 2026
23 checks passed
@silviuaavram silviuaavram deleted the feat/remove-disable-escape-key-down-prop branch February 20, 2026 08:15
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. v9.x

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Dialog] Remove disableEscapeKeyDown prop, in favor of using the onClose callback

4 participants