fix: add autofocus to auth fields (#6483)
This commit is contained in:
@@ -70,7 +70,7 @@ export default class ApiKeyAuth extends React.Component {
|
|||||||
<label>Value:</label>
|
<label>Value:</label>
|
||||||
{
|
{
|
||||||
value ? <code> ****** </code>
|
value ? <code> ****** </code>
|
||||||
: <Col><Input type="text" onChange={ this.onChange }/></Col>
|
: <Col><Input type="text" onChange={ this.onChange } autoFocus/></Col>
|
||||||
}
|
}
|
||||||
</Row>
|
</Row>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ export default class BasicAuth extends React.Component {
|
|||||||
<label>Username:</label>
|
<label>Username:</label>
|
||||||
{
|
{
|
||||||
username ? <code> { username } </code>
|
username ? <code> { username } </code>
|
||||||
: <Col><Input type="text" required="required" name="username" onChange={ this.onChange }/></Col>
|
: <Col><Input type="text" required="required" name="username" onChange={ this.onChange } autoFocus/></Col>
|
||||||
}
|
}
|
||||||
</Row>
|
</Row>
|
||||||
<Row>
|
<Row>
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ export default class Oauth2 extends React.Component {
|
|||||||
{
|
{
|
||||||
isAuthorized ? <code> { this.state.username } </code>
|
isAuthorized ? <code> { this.state.username } </code>
|
||||||
: <Col tablet={10} desktop={10}>
|
: <Col tablet={10} desktop={10}>
|
||||||
<input id="oauth_username" type="text" data-name="username" onChange={ this.onInputChange }/>
|
<input id="oauth_username" type="text" data-name="username" onChange={ this.onInputChange } autoFocus/>
|
||||||
</Col>
|
</Col>
|
||||||
}
|
}
|
||||||
</Row>
|
</Row>
|
||||||
|
|||||||
@@ -7,6 +7,17 @@ describe("OAuth2 Application flow", function() {
|
|||||||
}).as("tokenRequest")
|
}).as("tokenRequest")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// https://github.com/swagger-api/swagger-ui/issues/6395
|
||||||
|
it("should have first authorization input autofocused", () => {
|
||||||
|
cy
|
||||||
|
.visit("/?url=http://localhost:3231/swagger.yaml")
|
||||||
|
.get(".btn.authorize")
|
||||||
|
.click()
|
||||||
|
|
||||||
|
cy.focused()
|
||||||
|
.should("have.id", "oauth_username")
|
||||||
|
})
|
||||||
|
|
||||||
it("should make an application flow Authorization header request", () => {
|
it("should make an application flow Authorization header request", () => {
|
||||||
cy
|
cy
|
||||||
.visit("/?url=http://localhost:3231/swagger.yaml")
|
.visit("/?url=http://localhost:3231/swagger.yaml")
|
||||||
|
|||||||
Reference in New Issue
Block a user