fix: associate HTML labels with inputs (#9599)
Refs #8879 Co-authored-by: morsko1 <morssko1@gmail.com>
This commit is contained in:
@@ -66,10 +66,17 @@ export default class ApiKeyAuth extends React.Component {
|
|||||||
<p>In: <code>{ schema.get("in") }</code></p>
|
<p>In: <code>{ schema.get("in") }</code></p>
|
||||||
</Row>
|
</Row>
|
||||||
<Row>
|
<Row>
|
||||||
<label>Value:</label>
|
<label htmlFor="api_key_value">Value:</label>
|
||||||
{
|
{
|
||||||
value ? <code> ****** </code>
|
value ? <code> ****** </code>
|
||||||
: <Col><Input type="text" onChange={ this.onChange } autoFocus/></Col>
|
: <Col>
|
||||||
|
<Input
|
||||||
|
id="api_key_value"
|
||||||
|
type="text"
|
||||||
|
onChange={ this.onChange }
|
||||||
|
autoFocus
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
}
|
}
|
||||||
</Row>
|
</Row>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -65,20 +65,34 @@ export default class BasicAuth extends React.Component {
|
|||||||
<Markdown source={ schema.get("description") } />
|
<Markdown source={ schema.get("description") } />
|
||||||
</Row>
|
</Row>
|
||||||
<Row>
|
<Row>
|
||||||
<label>Username:</label>
|
<label htmlFor="auth_username">Username:</label>
|
||||||
{
|
{
|
||||||
username ? <code> { username } </code>
|
username ? <code> { username } </code>
|
||||||
: <Col><Input type="text" required="required" name="username" onChange={ this.onChange } autoFocus/></Col>
|
: <Col>
|
||||||
|
<Input
|
||||||
|
id="auth_username"
|
||||||
|
type="text"
|
||||||
|
required="required"
|
||||||
|
name="username"
|
||||||
|
onChange={ this.onChange }
|
||||||
|
autoFocus
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
}
|
}
|
||||||
</Row>
|
</Row>
|
||||||
<Row>
|
<Row>
|
||||||
<label>Password:</label>
|
<label htmlFor="auth_password">Password:</label>
|
||||||
{
|
{
|
||||||
username ? <code> ****** </code>
|
username ? <code> ****** </code>
|
||||||
: <Col><Input autoComplete="new-password"
|
: <Col>
|
||||||
|
<Input
|
||||||
|
id="auth_password"
|
||||||
|
autoComplete="new-password"
|
||||||
name="password"
|
name="password"
|
||||||
type="password"
|
type="password"
|
||||||
onChange={ this.onChange }/></Col>
|
onChange={ this.onChange }
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
}
|
}
|
||||||
</Row>
|
</Row>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import React, { PureComponent } from "react"
|
|||||||
import PropTypes from "prop-types"
|
import PropTypes from "prop-types"
|
||||||
import { fromJS, List } from "immutable"
|
import { fromJS, List } from "immutable"
|
||||||
import { getKnownSyntaxHighlighterLanguage } from "core/utils/jsonParse"
|
import { getKnownSyntaxHighlighterLanguage } from "core/utils/jsonParse"
|
||||||
|
import createHtmlReadyId from "core/utils/create-html-ready-id"
|
||||||
|
|
||||||
const NOOP = Function.prototype
|
const NOOP = Function.prototype
|
||||||
|
|
||||||
@@ -118,6 +119,9 @@ export default class ParamBody extends PureComponent {
|
|||||||
language = "json"
|
language = "json"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const regionId = createHtmlReadyId(`${pathMethod[1]}${pathMethod[0]}_parameters`)
|
||||||
|
const controlId = `${regionId}_select`
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="body-param" data-param-name={param.get("name")} data-param-in={param.get("in")}>
|
<div className="body-param" data-param-name={param.get("name")} data-param-in={param.get("in")}>
|
||||||
{
|
{
|
||||||
@@ -137,14 +141,16 @@ export default class ParamBody extends PureComponent {
|
|||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
<label htmlFor="">
|
<label htmlFor={controlId}>
|
||||||
<span>Parameter content type</span>
|
<span>Parameter content type</span>
|
||||||
<ContentType
|
<ContentType
|
||||||
value={ consumesValue }
|
value={ consumesValue }
|
||||||
contentTypes={ consumes }
|
contentTypes={ consumes }
|
||||||
onChange={onChangeConsumes}
|
onChange={onChangeConsumes}
|
||||||
className="body-param-content-type"
|
className="body-param-content-type"
|
||||||
ariaLabel="Parameter content type" />
|
ariaLabel="Parameter content type"
|
||||||
|
controlId={controlId}
|
||||||
|
/>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -38,13 +38,19 @@ export default class ParameterIncludeEmpty extends Component {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<label className={cx("parameter__empty_value_toggle", {
|
<label
|
||||||
|
htmlFor="include_empty_value"
|
||||||
|
className={cx("parameter__empty_value_toggle", {
|
||||||
"disabled": isDisabled
|
"disabled": isDisabled
|
||||||
})}>
|
})}
|
||||||
<input type="checkbox"
|
>
|
||||||
|
<input
|
||||||
|
id="include_empty_value"
|
||||||
|
type="checkbox"
|
||||||
disabled={isDisabled}
|
disabled={isDisabled}
|
||||||
checked={!isDisabled && isIncluded}
|
checked={!isDisabled && isIncluded}
|
||||||
onChange={this.onCheckboxChange} />
|
onChange={this.onCheckboxChange}
|
||||||
|
/>
|
||||||
Send empty value
|
Send empty value
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import React, { Component } from "react"
|
|||||||
import PropTypes from "prop-types"
|
import PropTypes from "prop-types"
|
||||||
import { Map, List } from "immutable"
|
import { Map, List } from "immutable"
|
||||||
import ImPropTypes from "react-immutable-proptypes"
|
import ImPropTypes from "react-immutable-proptypes"
|
||||||
|
import createHtmlReadyId from "core/utils/create-html-ready-id"
|
||||||
|
|
||||||
export default class Parameters extends Component {
|
export default class Parameters extends Component {
|
||||||
|
|
||||||
@@ -120,6 +121,8 @@ export default class Parameters extends Component {
|
|||||||
const isExecute = tryItOutEnabled && allowTryItOut
|
const isExecute = tryItOutEnabled && allowTryItOut
|
||||||
const isOAS3 = specSelectors.isOAS3()
|
const isOAS3 = specSelectors.isOAS3()
|
||||||
|
|
||||||
|
const regionId = createHtmlReadyId(`${pathMethod[1]}${pathMethod[0]}_requests`)
|
||||||
|
const controlId = `${regionId}_select`
|
||||||
|
|
||||||
const requestBody = operation.get("requestBody")
|
const requestBody = operation.get("requestBody")
|
||||||
|
|
||||||
@@ -215,7 +218,7 @@ export default class Parameters extends Component {
|
|||||||
<div className="opblock-section-header">
|
<div className="opblock-section-header">
|
||||||
<h4 className={`opblock-title parameter__name ${requestBody.get("required") && "required"}`}>Request
|
<h4 className={`opblock-title parameter__name ${requestBody.get("required") && "required"}`}>Request
|
||||||
body</h4>
|
body</h4>
|
||||||
<label>
|
<label id={controlId}>
|
||||||
<ContentType
|
<ContentType
|
||||||
value={oas3Selectors.requestContentType(...pathMethod)}
|
value={oas3Selectors.requestContentType(...pathMethod)}
|
||||||
contentTypes={requestBody.get("content", List()).keySeq()}
|
contentTypes={requestBody.get("content", List()).keySeq()}
|
||||||
@@ -223,7 +226,9 @@ export default class Parameters extends Component {
|
|||||||
this.onChangeMediaType({ value, pathMethod })
|
this.onChangeMediaType({ value, pathMethod })
|
||||||
}}
|
}}
|
||||||
className="body-param-content-type"
|
className="body-param-content-type"
|
||||||
ariaLabel="Request content type" />
|
ariaLabel="Request content type"
|
||||||
|
controlId={controlId}
|
||||||
|
/>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div className="opblock-description-wrapper">
|
<div className="opblock-description-wrapper">
|
||||||
|
|||||||
@@ -71,21 +71,36 @@ export default class HttpAuth extends React.Component {
|
|||||||
<Markdown source={ schema.get("description") } />
|
<Markdown source={ schema.get("description") } />
|
||||||
</Row>
|
</Row>
|
||||||
<Row>
|
<Row>
|
||||||
<label>Username:</label>
|
<label htmlFor="auth-basic-username">Username:</label>
|
||||||
{
|
{
|
||||||
username ? <code> { username } </code>
|
username ? <code> { username } </code>
|
||||||
: <Col><Input type="text" required="required" name="username" aria-label="auth-basic-username" onChange={ this.onChange } autoFocus/></Col>
|
: <Col>
|
||||||
|
<Input
|
||||||
|
id="auth-basic-username"
|
||||||
|
type="text"
|
||||||
|
required="required"
|
||||||
|
name="username"
|
||||||
|
aria-label="auth-basic-username"
|
||||||
|
onChange={ this.onChange }
|
||||||
|
autoFocus
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
}
|
}
|
||||||
</Row>
|
</Row>
|
||||||
<Row>
|
<Row>
|
||||||
<label>Password:</label>
|
<label htmlFor="auth-basic-password">Password:</label>
|
||||||
{
|
{
|
||||||
username ? <code> ****** </code>
|
username ? <code> ****** </code>
|
||||||
: <Col><Input autoComplete="new-password"
|
: <Col>
|
||||||
|
<Input
|
||||||
|
id="auth-basic-password"
|
||||||
|
autoComplete="new-password"
|
||||||
name="password"
|
name="password"
|
||||||
type="password"
|
type="password"
|
||||||
aria-label="auth-basic-password"
|
aria-label="auth-basic-password"
|
||||||
onChange={ this.onChange }/></Col>
|
onChange={ this.onChange }
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
}
|
}
|
||||||
</Row>
|
</Row>
|
||||||
{
|
{
|
||||||
@@ -110,10 +125,18 @@ export default class HttpAuth extends React.Component {
|
|||||||
<Markdown source={ schema.get("description") } />
|
<Markdown source={ schema.get("description") } />
|
||||||
</Row>
|
</Row>
|
||||||
<Row>
|
<Row>
|
||||||
<label>Value:</label>
|
<label htmlFor="auth-bearer-value">Value:</label>
|
||||||
{
|
{
|
||||||
value ? <code> ****** </code>
|
value ? <code> ****** </code>
|
||||||
: <Col><Input type="text" aria-label="auth-bearer-value" onChange={ this.onChange } autoFocus/></Col>
|
: <Col>
|
||||||
|
<Input
|
||||||
|
id="auth-bearer-value"
|
||||||
|
type="text"
|
||||||
|
aria-label="auth-bearer-value"
|
||||||
|
onChange={ this.onChange }
|
||||||
|
autoFocus
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
}
|
}
|
||||||
</Row>
|
</Row>
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user