Is your feature request related to a problem or use case? Please describe.
The Modal Component's beforeClose() callback only accepts a callback method that returns boolean. That means, no async operations can be performed within the callback. This prevents user from being able to perform async validation inside the .beforeClose() callback, when deciding whether the modal should be closed or not. For example, if we want to submit a form from a modal, and the API call returns error, we keep the modal opened and display an error message.
Describe the solution you'd like
The Modal component would work better if the .beforeClose() can also accept a callback that returns a Promise, so that when .close() is called on the modal, the beforeClose() callback can be executed asynchronously.
Describe alternatives you've considered
Instead of using .beforeClose() to decide whether a modal should be closed, we hardcode the validation process into the onClick method in the button that closes the modal, and only invokes modal.close() if validation passes.
Additional context
And what application do you work on?
Infor Workforce Management(WFM)
Is your feature request related to a problem or use case? Please describe. The Modal Component's beforeClose() callback only accepts a callback method that returns boolean. That means, no async operations can be performed within the callback. This prevents user from being able to perform async validation inside the .beforeClose() callback, when deciding whether the modal should be closed or not. For example, if we want to submit a form from a modal, and the API call returns error, we keep the modal opened and display an error message.
Describe the solution you'd like The Modal component would work better if the .beforeClose() can also accept a callback that returns a Promise, so that when .close() is called on the modal, the beforeClose() callback can be executed asynchronously.
Describe alternatives you've considered Instead of using .beforeClose() to decide whether a modal should be closed, we hardcode the validation process into the onClick method in the button that closes the modal, and only invokes modal.close() if validation passes.
Additional context And what application do you work on? Infor Workforce Management(WFM)