Problem
The shared Form component initializes in a native bundle but its submit behavior requires DOM APIs.
Audited at v0.2.546, commit 0013ce66e3.
Reproduced evidence
A screen containing shared Form with an input and submit button compiles and registers onSubmitEditing. Dispatching that registered event through the native bridge rejects with:
TypeError: event.preventDefault is not a functionThe next operation in the handler constructs new FormData(event.target), another browser-specific dependency. Merely adding preventDefault would not complete the form contract.
Source: Form submit and field handling.
Requested change
Provide a portable form-value/submission contract so the same Form component works with browser and native controls. Keep validation and form state in shared logic, with platform collection/event behavior behind an adapter.
Acceptance
- Native field edits update named form values.
- Submit gathers current values, including initial and hidden values where applicable.
- Required, custom, change, and blur validation retain shared semantics.
- Submission state, error/success events, and reset behavior work on both targets.
- A submit button actually triggers form submission on native; a manually injected event alone is not sufficient coverage.
- No dependency on DOM FormData or DOM event methods in the shared native execution path.
- Tests cover an actual shared Form with shared controls, on both targets.
Priority
Third in the portability audit sequence, after portable component props/events and correct control translation. The submit exception was reproduced in a DOM-free bundle harness; subsequent FormData incompatibility is established by source inspection.
Related audit issues
- fix(native): make shared component reactive props and emitted events host-independent: https://github.com/stacksjs/stx/issues/2086
- fix(native): preserve interactive label children and translate input types correctly: https://github.com/stacksjs/stx/issues/2087