-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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 component has no default onRequestClose behavior #2373
Comments
We have 2 solutions:
However, there is a problem with solution 2. If the component is to be Uncontrolled there are no "User Actions" on the component that can trigger it to pop. That means we will have to undeprecate |
@subjectix Thanks, now, I remember why it's gone. |
Ok. Now do you think we should differ any improvements to the docs until we entirely revise how they are structured and generated? Or this takes priority? |
I haven't started yet. No need to differ. |
OK then. |
@subjectix I don't think it's an unreasonable request for the user if documented. But it seems pretty easy to just close the dialog on the in That would mean that built in close requests work (like clicking on the overlay) and if the User Actions need to close the Dialog then the user can go ahead and implement that. |
Though to be fair I'm not totally aware of the consequences of controlled vs uncontrolled in MUI so I could be wrong. |
@aweary We are more or less following their API https://github.com/rackt/react-modal. |
But then how would the value provided via the |
That's fair, I think documenting this behavior is best then 👍 |
This isn't documented at all, so either it should be changed or documented. Currently _onRequestClose
calls
this.props.onRequestClose
if it exists, but does nothing otherwise.https://github.com/callemall/material-ui/blob/master/src/dialog.jsx#L371
It seems the component should just close the the Dialog by default with
_onRequestClose
if there is nothis.props.onRequestClose
. This way the expected behavior (closing when requested to be closed) is the default and if the user needs to implement more advance logic then they can.I can get a PR for this if you guys agree.
The text was updated successfully, but these errors were encountered: