How to submit a form with a button outside of the form's DOM structure using Radix UI's Alert Dialog #2607
-
Beta Was this translation helpful? Give feedback.
Answered by
benoitgrelard
Feb 27, 2024
Replies: 1 comment
-
It's because So in this case, your best bet would be to not use |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
benoitgrelard
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 callingevent.preventDefault
inonClick
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.