Greater-London-Authority / ldn-viz-tools

https://greater-london-authority.github.io/ldn-viz-tools/
1 stars 0 forks source link

Update Checkbox so name prop required and id is optional #207

Closed PaulioRandall closed 5 months ago

PaulioRandall commented 8 months ago

What does this change?

Regarding Checkbox component:

  1. Adds a required name prop.
  2. Promotes name prop to primary identifier.
  3. Demotes id prop to optional.

Why?

HTML form fields must have a name attribute as it is paired with the field value during submission, e.g. name1=value1&name2=value2. name must be unique within its <form>.

The id is not used by the form but still useful for general element stuff, e.g. CSS & JS selector.

Related issues:

Resolves #205.

How is it tested?

Storybook.

How is it documented?

Storybook.

PaulioRandall commented 5 months ago

@jamesscottbrown This still needs to be done but I think this branch is too out of date. It's a small change so I will do it in a new branch and PR.