[ic-text-field]: Pressing `Enter` in a form should submit the form
Summary
Whilst focus is on an ic-text-field and the <ic-text-field> is in a <form>, pressing Enter in the text field should submit the form.
💰 Use value
According to Mozilla: "The submit event fires when:
- the user clicks a submit button,
- the user presses Enter while editing a field (e.g. ) in a form,
- a script calls the form.requestSubmit() method"
📝 Acceptance Criteria
GIVEN a user has a form
WHEN there is an ic-text-field in the form
AND focus is on the ic-text-field
AND there are no required form fields in the form
THEN, pressing the "Enter" key should submit the form
GIVEN a user has a form
WHEN there is an ic-text-field in the form
AND focus is on the ic-text-field
AND there are required form fields in the form
AND all the required form fields have been actioned or contain text
THEN, pressing the "Enter" key should submit the form
GIVEN a user has a form
WHEN there is an ic-text-field in the form
AND focus is on the ic-text-field
AND there are required form fields in the form
AND some of the required form fields have not been actioned or do not contain text
THEN, pressing the "Enter" key should not submit the form
Additional information
Questions:
- do we have a defined list of form components?
Add a test for using inputs with a form
Explore if the text field should support validation of required fields: https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/submit_event