Skip to content

Commit

Permalink
docs(checkbox/radio): Fix accessibility warnings in code snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
lzcabrera committed Feb 7, 2018
1 parent 593da04 commit 9481d7c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 18 deletions.
23 changes: 13 additions & 10 deletions src/components/Checkbox/Checkbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,21 @@ A stand-alone checkbox is used for a single option that the user can turn on or
<a href="https://www.nngroup.com/articles/checkboxes-vs-radio-buttons/" target="_blank">Reference</a>

```
<Box tag="fieldset" between={2}>
<Text bold size="medium">
Show me deals for:
</Text>
<Checkbox name="services" value="mobility" label="Mobility" />
<Checkbox name="services" value="internet" label="Internet" />
<Checkbox name="services" value="tv" label="TV" />
<Checkbox name="services" value="home-phone" label="Home Phone" />
</Box>
<fieldset>
<Box tag="fieldset" between={2}>
<legend>
<Text bold size="medium">
Show me deals for:
</Text>
</legend>
<Checkbox name="services" value="mobility" label="Mobility" />
<Checkbox name="services" value="internet" label="Internet" />
<Checkbox name="services" value="tv" label="TV" />
<Checkbox name="services" value="home-phone" label="Home Phone" />
</Box>
</fieldset>

This comment has been minimized.

Copy link
@ryanoglesby08

ryanoglesby08 Feb 7, 2018

Contributor

Is this on purpose? There are nested fieldsets now...

This comment has been minimized.

Copy link
@lzcabrera

lzcabrera Feb 7, 2018

Author Member

oops. I just fixed it. It looks like all i needed to add was <legend>

```


### Getting feedback for an unchecked checkbox

Use the feedback and error props to give the user feedback regarding a missed checkbox by highlighting the label, checkbox element and adding an error message stating how to proceed.
Expand Down
20 changes: 12 additions & 8 deletions src/components/Radio/Radio.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Radio buttons are used when there is a list of two or more options that are mutu

* Use when there can only be exactly one choice from mulitple options
* Use there are 2-6 options to choose from
* Use [`Select`](#select) (dropdown) when there are over 6 options
* Use [`Select`](#select) (dropdown) when there are over 6 options

```
initialState = {
Expand All @@ -17,11 +17,15 @@ initialState = {
const setChoice = (event) => setState({choice: event.target.value});
<Box tag="fieldset" between={2}>
<Text bold size="medium">
How would you like to recieve your monthly bill?
</Text>
<Radio label="e.Bill" name="monthly-bill" value="e.Bill" checked={state.choice === "e.bill"} onChange={setChoice} />
<Radio label="Paper bill" name="monthly-bill" value="paper bill" checked={state.choice === "paper bill"} onChange={setChoice} />
</Box>
<fieldset>
<Box tag="fieldset" between={2}>
<legend>
<Text bold size="medium">
How would you like to recieve your monthly bill?
</Text>
</legend>
<Radio label="e.Bill" name="monthly-bill" value="e.Bill" checked={state.choice === "e.bill"} onChange={setChoice} />
<Radio label="Paper bill" name="monthly-bill" value="paper bill" checked={state.choice === "paper bill"} onChange={setChoice} />
</Box>
</fieldset>
```

0 comments on commit 9481d7c

Please sign in to comment.