-
-
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
onopen
callback for Drawer component
#36728
Comments
Actually, the Drawer component does have a callback that you can use to trigger an action when the opening transition is complete. It's called 'onTransitionEnd', and it's exactly what you're looking for. Instead of using a timeout to wait for the drawer to open completely, you can simply attach your desired action to the 'onTransitionEnd' callback, and it will be executed automatically when the opening transition is finished. |
Great to hear that 'onTransitionEnd' worked for you! The reason it wasn't mentioned in the MUI library documentation is because it's not actually a function of the library itself. Instead, 'onTransitionEnd' is an event that's triggered on certain HTML elements when a CSS transition is completed. You can find more information on this event in the MDN web docs (https://developer.mozilla.org/en-US/docs/Web/API/Element/transitionend_event). So while 'onTransitionEnd' isn't explicitly documented by MUI, it's a widely-used event in web development that can be applied to a variety of HTML elements. |
@Depender-Sethi ... that makes complete sense. Thank you very much for your help. I appreciate it a lot. 🙌 |
Duplicates
Latest version
Summary 💡
Currently, there's no
onOpen
callback in drawer component and because of that I'm having to set a timeout to wait for the drawer to completely open and do something.Examples 🌈
Here is the code sandbox. Link
Motivation 🔦
I want to do things when the drawer is completely opened. For example: open autocomplete programmatically.
The text was updated successfully, but these errors were encountered: