Form submit handler without preventDefault
Part of Code Quality & Syntax, which counts for 20% of the overall score. When this check fires it deducts 4 points from that category, once per scan, no matter how many places it turns up.
What it detects
A <form on:submit={fn}> with no |preventDefault modifier still performs the browser default submit, which reloads the page and discards your handler work. Add on:submit|preventDefault, or return from the handler with the native event prevented. Heuristic: a SvelteKit form using method/action with use:enhance intends the native submit and can be ignored.
Why it matters
A <form> with an on:submit handler but no preventDefault still performs the browser default submit, which navigates or reloads the page. Your handler may run, but the reload interrupts it and throws away any client state, so client-side form logic appears to briefly work and then vanish. This is a heuristic: a SvelteKit form that uses method and action with use:enhance intends the native submit and is fine.
How to fix it
Add the modifier: on:submit|preventDefault={handler}. If you are using SvelteKit progressive enhancement, keep the native submit and use the use:enhance action on the form instead of a manual handler. Do not call event.preventDefault() by hand inside the handler when the modifier already does it.
The paid report includes a ready-to-paste prompt for your AI coding agent for every check it finds, pointed at the exact findings from your scan. See pricing
Does your repo trip this check?
Paste a GitHub URL or drop a project folder. Scans run in your browser and take seconds.
Scan your repo