Skip to content

How to submit a form with a button outside of the form's DOM structure using Radix UI's Alert Dialog #2607

Answered by benoitgrelard
pytest3 asked this question in Help
Discussion options

You must be logged in to vote

It's because AlertDialog.Action closes the dialog on click. Normally we would recommend to prevent the library's default behaviour in such cases by calling event.preventDefault in onClick but unfortunately here it would also prevent submission.

So in this case, your best bet would be to not use AlertDialog.Action but use your button straight away instead.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by benoitgrelard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants