cheogram-www

created pr with cheogram-www/validate-form-on-execute.1 on 2026-11-20T17:08:51Z · by 3c31bc8c
added cheogram-www/validate-form-on-execute.2 on 2026-11-20T17:25:58Z · by 3c31bc8c
1: a03bb2b = 1: a03bb2b Use reportValidity to trigger browser validations
added cheogram-www/validate-form-on-execute.3 on 2026-11-20T17:31:42Z · by 3c31bc8c
1: a03bb2b < -: ------- Use reportValidity to trigger browser validations
-: ------- > 1: c241180 Use reportValidity to trigger browser validations
cmds
checkout latest patchset:
ssh pr.pico.sh pull cheogram-www:validate-form-on-execute | git am -3
checkout specific patchset revision:
ssh pr.pico.sh pull cheogram-www:validate-form-on-execute [rev] | git am -3
add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh cheogram-www:validate-form-on-execute
add comment to patch request:
ssh pr.pico.sh comment cheogram-www:validate-form-on-execute "lgtm!"

Patchset cheogram-www/validate-form-on-execute.1 on 2026-11-20T17:08:51Z · commit a03bb2b

Use reportValidity to trigger browser validations
Eric Roberts 2026-11-20T17:04:41Z
Excluded cancel and prev as you wouldn't want to have to fill in
something just to cancel or go back. I'm assuming all other actions
should be validated, but this may turn out to be a bad assumption, I'm
not sure.

Normally clicking a button of type submit would do this validation, and
we add type submit to buttons for the first action. However because the
execute then causes the button to not exist on the page, the event never
makes it to the form.

I tried moving execute to the form onSubmit, and then making the buttons
be submit, so it would just trigger the default validation behaviour.
But this had other problems like in ButtonGrid closing the dialog for
custom input causes the button not to be rendered and the form submit
not to happen.

So this seems like the smallest change that is reasonable to make with
what I know right now. I still don't love it.
Diff stat
1 file changed, 7 insertions(+)
Semantic diff summary
0 added, 0 modified, 0 signature changed, 0 removed across 1 analyzed file
+7 -0 src/components/CommandSession.tsx #
......@@ -34,6 +34,13 @@ const CommandSessionInner = ({
3434 }
3535
3636 const execute = (action: string | null) => {
37+ if (
38+ !["cancel", "prev"].includes(action ?? "") &&
39+ formRef.current?.reportValidity() === false
40+ ) {
41+ return;
42+ }
43+
3744 const data =
3845 formRef.current && !form.isResult()
3946 ? new FormData(formRef.current)
Back to top