-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
STATUS-3: works as expectedThis issue is closed because the behavior is correct and expectedThis issue is closed because the behavior is correct and expectedTYPE: bugSomething isn't workingSomething isn't working
Description
Which component is affected?
Qwik Runtime
Describe the bug
The onSubmit$
event handler on a form
is not respecting preventDefault
. For example, in the form below:
<form
onSubmit$={$((event) => {
event.preventDefault();
console.log('default prevented');
})}
>
<button type="submit">Hello World</button>
</form>
Expected Results
The form should not be submitted and the console should print "default prevented".
Actual Results
The form is submitted, the default action on the event is never prevented, and nothing is printed to the console.
Reproduction
https://stackblitz.com/edit/github-etyhm2js-2mqst9no?file=src%2Froutes%2Findex.tsx
Steps to reproduce
- Create an HTML
form
that has anonSubmit$
handler. - Within the form
onSubmit$
handler, define the handler as:
$((event) => {
event.preventDefault();
console.log('default prevented');
}
- Add a
button
of typesubmit
within the form. - Click the button to submit the form.
System Info
System:
OS: Linux 5.0 undefined
CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 0 Bytes / 0 Bytes
Shell: 1.0 - /bin/jsh
Binaries:
Node: 18.20.3 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 10.2.3 - /usr/local/bin/npm
pnpm: 8.15.6 - /usr/local/bin/pnpm
npmPackages:
@builder.io/qwik: ^1.7.3 => 1.12.0
@builder.io/qwik-city: ^1.7.3 => 1.12.0
typescript: 5.4.5 => 5.4.5
undici: * => 7.2.0
vite: ^5.2.10 => 5.4.11
Additional Information
No response
Metadata
Metadata
Assignees
Labels
STATUS-3: works as expectedThis issue is closed because the behavior is correct and expectedThis issue is closed because the behavior is correct and expectedTYPE: bugSomething isn't workingSomething isn't working