mirror of
https://github.com/we-promise/sure.git
synced 2026-05-30 15:59:02 +00:00
fix(savings_goals/new): trap Enter on step 1; add funding-accounts hint
- Pressing Enter inside a step-1 input (Name, Target amount, Target date) used to fire the form-implicit-submission against the sr-only submit button, jumping straight to POST /savings_goals and skipping step 2 entirely (no initial contribution, no review). - New blockEnter action on the form re-routes Enter to next() when currentStep === 1, mirroring the Continue button. Notes textarea is exempt so newlines work. - Add an inline hint under the funding-accounts label so users know up front what the field controls; previously the only feedback was a tiny "must pick one" error after Continue.
This commit is contained in:
@@ -49,6 +49,15 @@ export default class extends Controller {
|
||||
this.refreshSubmitState();
|
||||
}
|
||||
|
||||
blockEnter(event) {
|
||||
if (this.currentStep !== 1) return;
|
||||
// Allow Enter in the notes textarea so newlines work.
|
||||
if (event.target.tagName === "TEXTAREA") return;
|
||||
event.preventDefault();
|
||||
// Mirror Continue: validate + advance instead of swallowing silently.
|
||||
this.next();
|
||||
}
|
||||
|
||||
footerLeft(event) {
|
||||
event.preventDefault();
|
||||
this.back();
|
||||
|
||||
Reference in New Issue
Block a user