-
Notifications
You must be signed in to change notification settings - Fork 57
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
Need more flexibility with dialog return keypress #21
Comments
What if you attached everything to the |
I want to prevent the dialog from closing in case the ajax response reports an error so teh user can try again. To do that I'd either have to use synchronous requests, or use some silly flags to indicate the close state. The three possible states in this case which all have different results are: success, failure, cancelled. Adding a closeOnReturn option is consistent with the current closeOnEscape option and it doesn't break backwards compatibility. Assuming that the dialog should always be closed with a success state when the enter key is pressed makes the code really ugly when that is an incorrect assumption. |
That's fair. I'll add a |
Cool. Thanks! |
Dialog by default closes on return keypress with success status. However, there doesn't seem to be a good way to prevent this if you want to use an ajax request to determine the success.
Example: I have a sign-in dialog that I want to appear throughout the site and have different success callbacks in some cases so I observe the container's ui:dialog:close:after event and success means the sign-in was successful and otherwise not. But if the user presses enter the dialog is closed with success and there is no way for my callback to distinguish a success from my ajax callback versus the return keypress.
Suggestion: at minimum, add a closeOnReturn option so this behavior can be easily disabled. Otherwise, it seems like the most logical action for the return keypress would be to trigger the click action of the primary button so that the actions attached to the button are executed instead of just always closing the window.
The text was updated successfully, but these errors were encountered: