Skip to content

Commit

Permalink
Merge pull request openedx#380 from edx/jkantor/arialabel
Browse files Browse the repository at this point in the history
fix(inputselect): add aria-label
  • Loading branch information
jansenk authored Jan 11, 2019
2 parents 34eb24f + 02e9f8b commit 41f977d
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .storybook/__snapshots__/Storyshots.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -22807,6 +22807,7 @@ exports[`Storyshots InputSelect basic usage 1`] = `
</label>
<select
aria-describedby="error-asInput20"
aria-label={undefined}
className="form-control is-invalid-nodanger"
disabled={false}
id="asInput20"
Expand Down Expand Up @@ -23957,6 +23958,7 @@ exports[`Storyshots InputSelect disabled usage 1`] = `
</label>
<select
aria-describedby="error-asInput24"
aria-label="Fruits"
className="form-control is-invalid-nodanger"
disabled={true}
id="asInput24"
Expand Down Expand Up @@ -24212,6 +24214,36 @@ exports[`Storyshots InputSelect disabled usage 1`] = `
</span>
</span>
</span>
<span>
<span>
<br />

</span>
<span
style={Object {}}
>
ariaLabel
</span>
<span>
=
<span
style={Object {}}
>
<span
style={
Object {
"color": "#22a",
"wordBreak": "break-word",
}
}
>
"
Fruits
"
</span>
</span>
</span>
</span>
<span>
<span>
<br />
Expand Down Expand Up @@ -25118,6 +25150,7 @@ exports[`Storyshots InputSelect separate labels and values 1`] = `
</label>
<select
aria-describedby="error-asInput21"
aria-label={undefined}
className="form-control is-invalid-nodanger"
disabled={false}
id="asInput21"
Expand Down Expand Up @@ -26421,6 +26454,7 @@ exports[`Storyshots InputSelect separate option groups 1`] = `
</label>
<select
aria-describedby="error-asInput22"
aria-label={undefined}
className="form-control is-invalid-nodanger"
disabled={false}
id="asInput22"
Expand Down Expand Up @@ -28084,6 +28118,7 @@ exports[`Storyshots InputSelect with disabled option 1`] = `
</label>
<select
aria-describedby="error-asInput25"
aria-label={undefined}
className="form-control is-invalid-nodanger"
disabled={false}
id="asInput25"
Expand Down Expand Up @@ -29415,6 +29450,7 @@ exports[`Storyshots InputSelect with validation 1`] = `
</label>
<select
aria-describedby="error-asInput23"
aria-label={undefined}
className="form-control is-invalid-nodanger"
disabled={false}
id="asInput23"
Expand Down
1 change: 1 addition & 0 deletions src/InputSelect/InputSelect.stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ storiesOf('InputSelect', module)
<InputSelect
name="fruits"
label="Fruits"
ariaLabel="Fruits"
value="strawberry"
options={[
'apple',
Expand Down
3 changes: 3 additions & 0 deletions src/InputSelect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ Provides an selector component called InputSelect that allows for various select

### `options` (string array or object array; required)
`options` specifies the list of options that the component will allow users to select from. This can be a simple array of strings, listing their options. It can also be an array containing more complex object in order to show the options in a grouped format.

### `ariaLabel` (string; optional)
`ariaLabel` specifies the aria-label for the input element.
1 change: 1 addition & 0 deletions src/InputSelect/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class Select extends React.Component {
type="select"
name={props.name}
value={props.value}
aria-label={props.ariaLabel}
aria-describedby={props.describedBy}
onChange={props.onChange}
onBlur={props.onBlur}
Expand Down

0 comments on commit 41f977d

Please sign in to comment.