-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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] Providing onKeyDown breaks closing via Escape #43738
Comments
I guess it's simply that the Modal doesn't follow the template, it should be? diff --git a/packages/mui-material/src/Modal/Modal.js b/packages/mui-material/src/Modal/Modal.js
index 60d29549ff..bbb7839368 100644
--- a/packages/mui-material/src/Modal/Modal.js
+++ b/packages/mui-material/src/Modal/Modal.js
@@ -156,6 +156,7 @@ const Modal = React.forwardRef(function Modal(inProps, ref) {
}
const externalForwardedProps = {
+ ...other,
slots: {
root: components.Root,
backdrop: components.Backdrop,
@@ -218,7 +219,7 @@ const Modal = React.forwardRef(function Modal(inProps, ref) {
* is not meant for humans to interact with directly.
* https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-static-element-interactions.md
*/}
- <RootSlot {...rootProps} {...other}>
+ <RootSlot {...rootProps}>
{!hideBackdrop && BackdropComponent ? (
<BackdropSlot {...backdropProps} ref={backdropRef} />
) : null} |
@oliviertassinari I would like to work on it. |
This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue. Note We value your feedback @hvolschenk! How was your experience with our support team? |
Steps to reproduce
Link to live example: codesandbox
Steps:
<Dialog />
.onKeyDown
line.<Dialog />
.Current behavior
When an
onKeyDown
handler is passed to the<Dialog />
component,the
Escape
key does not work to close the<Dialog />
anymore.Expected behavior
Just like it used to in
v5
, the<Dialog />
should close when pressingEscape
even when an
onKeyDown
is supplied inv6
.Context
No response
Your environment
Check the codesandbox.
Search keywords: dialog, onKeyDown, escape
The text was updated successfully, but these errors were encountered: