atomic-server icon indicating copy to clipboard operation
atomic-server copied to clipboard

Dialog forms are not valid HTML forms - no keyboard support

Open joepio opened this issue 1 year ago • 1 comments

The Dialog component renders three sections DialogTitle, DialogContent, DialogActions. Currently, I've seen the formelement being used inside theDialogContent. This leads to a situations where the form's onSubmitattribute is not called if a user pressesenter`.

How do we deal with this?

Pass an onSubmit to Dialog

If this is a passed, turn the Dialog wrapper into a form.

Pass onSubmit to useDialog

Always render forms?

Maybe all dialogs are forms by default? Maybe that's the case now, but I'm not sure whether that remains true.

@Polleps what are your thoughts?

joepio avatar Dec 12 '23 10:12 joepio

onSubmit should be called when a user presses enter and is focussed on an input inside a form that has a submit handler. The only reason it wouldn't fire is if the input were invalid, otherwise it's a browser bug but I think it's more likely just something else that doesn't work.

What specific dialog are you talking about?

Polleps avatar Dec 12 '23 16:12 Polleps