Skip to content

Commit 4abbc62

Browse files
gileswellsediioteroMike Lumetta
authored
fix: add aria label to select element for content types (#7133)
Co-authored-by: ediiotero <[email protected]> Co-authored-by: Mike Lumetta <[email protected]>
1 parent 3d20894 commit 4abbc62

File tree

5 files changed

+15
-6
lines changed

5 files changed

+15
-6
lines changed

src/core/components/content-type.jsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ export default class ContentType extends React.Component {
1111
contentTypes: PropTypes.oneOfType([ImPropTypes.list, ImPropTypes.set, ImPropTypes.seq]),
1212
value: PropTypes.string,
1313
onChange: PropTypes.func,
14-
className: PropTypes.string
14+
className: PropTypes.string,
15+
ariaLabel: PropTypes.string
1516
}
1617

1718
static defaultProps = {
@@ -40,14 +41,14 @@ export default class ContentType extends React.Component {
4041
onChangeWrapper = e => this.props.onChange(e.target.value)
4142

4243
render() {
43-
let { contentTypes, className, value } = this.props
44+
let { contentTypes, className, value, ariaLabel } = this.props
4445

4546
if ( !contentTypes || !contentTypes.size )
4647
return null
4748

4849
return (
4950
<div className={ "content-type-wrapper " + ( className || "" ) }>
50-
<select className="content-type" value={value || ""} onChange={this.onChangeWrapper} >
51+
<select className="content-type" aria-label={ariaLabel} value={value || ""} onChange={this.onChangeWrapper} >
5152
{ contentTypes.map( (val) => {
5253
return <option key={ val } value={ val }>{ val }</option>
5354
}).toArray()}

src/core/components/param-body.jsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,12 @@ export default class ParamBody extends PureComponent {
133133
}
134134
<label htmlFor="">
135135
<span>Parameter content type</span>
136-
<ContentType value={ consumesValue } contentTypes={ consumes } onChange={onChangeConsumes} className="body-param-content-type" />
136+
<ContentType
137+
value={ consumesValue }
138+
contentTypes={ consumes }
139+
onChange={onChangeConsumes}
140+
className="body-param-content-type"
141+
ariaLabel="Parameter content type" />
137142
</label>
138143
</div>
139144

src/core/components/parameters/parameters.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,8 @@ export default class Parameters extends Component {
220220
onChange={(value) => {
221221
this.onChangeMediaType({ value, pathMethod })
222222
}}
223-
className="body-param-content-type" />
223+
className="body-param-content-type"
224+
ariaLabel="Request content type" />
224225
</label>
225226
</div>
226227
<div className="opblock-description-wrapper">

src/core/components/response.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ export default class Response extends React.Component {
197197
: Seq()
198198
}
199199
onChange={this._onContentTypeChange}
200+
ariaLabel="Media Type"
200201
/>
201202
{controlsAcceptHeader ? (
202203
<small className="response-control-media-type__accept-message">

src/core/components/responses.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ export default class Responses extends React.Component {
9595
<ContentType value={producesValue}
9696
onChange={this.onChangeProducesWrapper}
9797
contentTypes={produces}
98-
className="execute-content-type"/>
98+
className="execute-content-type"
99+
ariaLabel="Response content type" />
99100
</label> }
100101
</div>
101102
<div className="responses-inner">

0 commit comments

Comments
 (0)