Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFR] Add Autofocus to login and creation form #2560

Merged
merged 1 commit into from
Nov 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/demo/src/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class Login extends Component {
<div className={classes.form}>
<div className={classes.input}>
<Field
autoFocus
name="username"
component={renderInput}
label={translate('ra.auth.username')}
Expand Down
1 change: 1 addition & 0 deletions examples/demo/src/products/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export const ProductCreate = withStyles(createStyles)(
<TabbedForm>
<FormTab label="resources.products.tabs.image">
<TextInput
autoFocus
source="image"
options={{ fullWidth: true }}
validate={required()}
Expand Down
1 change: 1 addition & 0 deletions examples/demo/src/visitors/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ export const VisitorCreate = withStyles(editStyles)(({ classes, ...props }) => (
<TabbedForm>
<FormTab label="resources.customers.tabs.identity">
<TextInput
autoFocus
source="first_name"
formClassName={classes.first_name}
/>
Expand Down
2 changes: 1 addition & 1 deletion examples/simple/src/posts/PostCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const PostCreate = ({ permissions, ...props }) => (
return errors;
}}
>
<TextInput source="title" />
<TextInput autoFocus source="title" />
<LongTextInput source="teaser" />
<RichTextInput source="body" />
<FormDataConsumer>
Expand Down
1 change: 1 addition & 0 deletions examples/simple/src/users/UserCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const UserCreate = ({ permissions, ...props }) => (
<TextInput
source="name"
defaultValue="Slim Shady"
autoFocus
validate={required()}
/>
</FormTab>
Expand Down
1 change: 1 addition & 0 deletions packages/ra-ui-materialui/src/auth/LoginForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const LoginForm = ({ classes, isLoading, handleSubmit, translate }) => (
<div className={classes.form}>
<div className={classes.input}>
<Field
autoFocus
id="username"
name="username"
component={renderInput}
Expand Down