ic-ui-kit icon indicating copy to clipboard operation
ic-ui-kit copied to clipboard

[ic-text-field]: Pressing `Enter` in a form should submit the form

Open GCHQ-Developer-112 opened this issue 1 year ago • 2 comments

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:

📝 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?

GCHQ-Developer-112 avatar Apr 18 '24 08:04 GCHQ-Developer-112

Add a test for using inputs with a form

MI6-255 avatar Apr 18 '24 08:04 MI6-255

Explore if the text field should support validation of required fields: https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/submit_event

MI6-255 avatar Apr 18 '24 09:04 MI6-255