Problem
AgnosticUI's Input component doesn't participate in native HTML form submission when used inside <form> elements. Custom form inputs that don't implement FormAssociated API lose automatic inclusion in FormData and form validation chains.
Current Behavior
When an AgnosticUI Input is placed inside a <form>, calling new FormData(form) omits the input's value entirely. This breaks standard form workflows:
<form id="login">
<AgInput name="email" />
<button type="submit">Login</button>
</form>
<script>
document.getElementById('login').addEventListener('submit', (e) => {
const data = new FormData(e.target);
console.log(data.get('email')); // null — input is invisible to FormData
});
</script>
This forces developers to manually track input state or use framework-specific form libraries, defeating the "framework-agnostic" promise and adding friction for AI-generated forms that expect native semantics.
Why This Matters
- Accessibility: Screen readers and assistive tools expect inputs to behave like native
<input> elements within forms
- AI Readiness: When Cursor, Claude, or agent-driven UI generators read the AgnosticUI source, they assume FormData integration works—hallucination risk when it doesn't
- Framework Portability: Developers porting forms between frameworks expect consistent form submission behavior
- Standards Compliance: The Form Associated Custom Elements API exists precisely for this use case
Expected Behavior
The Input component should:
- Implement the
ElementInternals API via attachInternals()
- Set the form value using
setFormValue() whenever the input value changes
- Honor the
name attribute so it appears in FormData with the correct key
- Participate in form validation states (
:invalid, :valid, :required)
- Respond to
form.reset() and restore its initial value
Reference
Related issue: #274 (Form Associated Custom Elements) identifies this as a priority enhancement.
The Input component lives in src/components/ag/Input/ and is used across all framework implementations. This change would benefit Button (with type="submit"), FormGroup, and all dependent components.
Acceptance Criteria
- Input element responds to
new FormData(form) and includes its value
- Input can be reset via
form.reset()
- Input participates in form validation (
:invalid CSS pseudo-class works)
- All framework implementations (Vue, React, Lit, Svelte) support the behavior
- Documented with example showing FormData integration
Contributed by Klement Gunndu
Problem
AgnosticUI's
Inputcomponent doesn't participate in native HTML form submission when used inside<form>elements. Custom form inputs that don't implement FormAssociated API lose automatic inclusion inFormDataand form validation chains.Current Behavior
When an AgnosticUI
Inputis placed inside a<form>, callingnew FormData(form)omits the input's value entirely. This breaks standard form workflows:This forces developers to manually track input state or use framework-specific form libraries, defeating the "framework-agnostic" promise and adding friction for AI-generated forms that expect native semantics.
Why This Matters
<input>elements within formsExpected Behavior
The
Inputcomponent should:ElementInternalsAPI viaattachInternals()setFormValue()whenever the input value changesnameattribute so it appears inFormDatawith the correct key:invalid,:valid,:required)form.reset()and restore its initial valueReference
Related issue: #274 (Form Associated Custom Elements) identifies this as a priority enhancement.
The Input component lives in
src/components/ag/Input/and is used across all framework implementations. This change would benefit Button (with type="submit"), FormGroup, and all dependent components.Acceptance Criteria
new FormData(form)and includes its valueform.reset():invalidCSS pseudo-class works)Contributed by Klement Gunndu