NYPL / nypl-design-system

React design system putting accessibility first.
https://nypl.github.io/nypl-design-system/reservoir/v3/?path=/docs/welcome--docs
Apache License 2.0
39 stars 6 forks source link

Add "radio" type to the `Input` component #317

Closed EdwinGuzman closed 4 years ago

EdwinGuzman commented 4 years ago

Component in question:

Description of issue:

It's what I'm doing now for LCA and I think it makes sense but I would include the fieldset and legend to make the whole component (which at this point is more like a molecule) accessible.

<fieldset>
  <legend id="radiobutton-location">I live, work, go to school, or pay property taxes at an address in:</legend>
  <input type="radio" id="input-location-nyc" class="input " value="nyc" name="location" aria-checked="true" checked=""> 
  <label id="radiobutton-location_nyc" for="location-nyc" class="label ">New York City (All five boroughs)</label>
  <input type="radio" id="input-location-nys" class="input " value="nys" name="location" aria-checked="false">
  <label id="radiobutton-location_nys" for="location-nys" class="label ">New York State (Outside NYC)</label>
  <input type="radio" id="input-location-us" class="input " value="us" name="location" aria-checked="false">
  <label id="radiobutton-location_us" for="location-us" class="label ">United States (Visiting NYC)</label>
</fieldset>

Sources: https://designsystem.digital.gov/components/form-controls/#radio-buttons https://a11y-style-guide.com/style-guide/section-forms.html#kssref-forms-radio-buttons https://webaim.org/techniques/forms/controls#radio

helenvholmes commented 4 years ago

We should definitely add a radio type to Input, that makes total sense to me.

I think for the particular the example you've included we would want another story over a brand new component that is built up of those HTML tags like we did with Autosuggest. I'm envisioning a new Input story that's exactly what you've included here that just uses the Input component.

EdwinGuzman commented 4 years ago

That works.

helenvholmes commented 4 years ago

Closed via #319.