mi6 / mi6/ic-ui-kit

Internal issue 3162 - The required prop on ICDS form fields should prevent the form submitting if the field is empty

Open
#4,285 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
53
Forks
63
Avg merge
2d 4h
Merged PRs (30d)
15

Description

If an ICDS form field (e.g. text field, select) is used in a semantic form, when the required prop is set, it should prevent the form submitting if the field is empty, as per native HTML behaviour.

The following stackblitz has a demo: [https://stackblitz.com/edit/1mi6c2f1?file=src%2Fapp.tsx&hideExplorer=1](https://stackblitz.com/edit/1mi6c2f1?file=src%2Fapp.tsx&hideExplorer=1)

It contains a form with one ICDS required text field and one HTML input with the required attribute. If you leave the html input empty and try to submit the form, it fails. If you fill in the html input and leave the ICDS one empty, the form will submit.

It would be really nice if, as well as preventing the form from submitting, the field automatically went into an inline error state with a configurable “This field is required” error text, similar to how the max/min characters behaviour works.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the StackBlitz reproduction in src/app.tsx and compare the ICDS required text field with the native HTML input during form submission. Trace the field's required and validation behavior, then verify that an empty required field blocks submission and displays configurable inline error text, including for the other field types named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.