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:
Guillem Arias
2026-05-11 19:32:50 +02:00
parent c622dabd20
commit f1bde676c6
3 changed files with 15 additions and 2 deletions

View File

@@ -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();